解决方式:
1.在requestMapping 中添加 produces
@RequestMapping(
value = "/login",
produces = "application/json;charset=utf-8",
method = RequestMethod.POST
)
2.在application.yml 中添加配置
spring:
http:
encoding:
force: true
charset: utf-8
enabled: true
3.解决单个字符串乱码
String name = new String(user.getName().getBytes("ISO-8859-1"),"UTF-8");