@ResponseBody乱码的解决方案比较简单,只要在spring的配置文件中,增加如下配置即可
02 | < bean class = "org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" /> |
03 | < bean class = "org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" > |
04 | < property name = "messageConverters" > |
06 | < bean class = "org.springframework.http.converter.StringHttpMessageConverter" > |
08 | < bean class = "org.springframework.beans.factory.config.MethodInvokingFactoryBean" > |
09 | < property name = "targetClass" value = "java.nio.charset.Charset" /> |
10 | < property name = "targetMethod" value = "forName" /> |
11 | < property name = "arguments" value = "UTF-8" /> |