解决办法:
我在拦截器里添加
response.setHeader("Content-type", "text/html;charset=UTF-8");
这句,但是返回的中文还是乱码,我把拦截器去掉后,返回正常,但是我需要这个拦截器实现request的跨域请求
后来我直接在
GetMapping(value = "/test2",produces = {"text/html;charset=UTF-8"})
public String test2() {}
添加produces = {"text/html;charset=UTF-8"}
返回的中文字符正常