<mvc:annotation-driven>
<mvc:message-converters>
     <!-- 将StringHttpMessageConverter的默认编码设为UTF-8 -->
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<constructor-arg value="UTF-8" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>

配置默认转换器的编码格式为UTF-8,源码里是ISO-8859-1

-------------------------------

<mvc:annotation-driven>标签开启了13个bean

包含了替换3.1之前的废弃bean

DefaultAnnotationHandlerMapping -> RequestMappingHandlerMapping

AnnotationMethodHandlerAdapter -> RequestMappingHandlerAdapter

AnnotationMethodHandlerExceptionResolver -> ExceptionHandlerExceptionResolver

---------------------------------------13个bean

mvcContentNegotiationManager,
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping,-----------启用了最新的RequestMappingHandlerMapping
mvcCorsConfigurations,
org.springframework.format.support.FormattingConversionServiceFactoryBean#0,
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter,---------启用了最新的RequestMappingHandlerAdapter
mvcUriComponentsContributor,
org.springframework.web.servlet.handler.MappedInterceptor#0,
org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,----------启用了最新的ExceptionHandlerExceptionResolver
org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,
org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,
org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,
org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,

spring mvc json乱码的更多相关文章

  1. Spring MVC JSON乱码问题

    之前项目中也遇到过返回JSON时乱码问题,当时找到了一个方法解决了问题但是没有明白原因,今天这个项目又遇到了JSON乱码问题,用之前的方法不行,看了这篇博文才明白为什么 @RequestMapping ...

  2. spring mvc json 返回乱码问题解决(vestion:3.x.x)

    本文是转载文章,感觉比较好,如有侵权,请联系本人,我将及时删除. 原文网址:<spring mvc json 返回乱码问题解决(vestion:3.x.x)> 工程中用springmvc返 ...

  3. spring mvc: json练习

    spring mvc: json练习 本例需要用到的json包: 如下: jackson-databind jackson-core jackson-annotations <!-- https ...

  4. Spring MVC JSON自己定义类型转换(续)

    前面提到了两种转换类型的方法(Spring MVC JSON自己定义类型转换),这里针对Json转换提供一种更简便的方法. 通过配置全局的日期转换来避免使用麻烦的注解. 首先用到了一个简单的日期工具类 ...

  5. spring mvc json返回防止乱码

    乱码问题 乱码一直是编程的常见问题,spring mvc 返回json数据时可能导致乱码,需要在controller中添加如下代码: @RequestMapping("/test" ...

  6. spring mvc 返回乱码SpringMVC使用@ResponseBody注解返回中文字符串乱码的问题

    原文地址:https://www.cnblogs.com/fzj16888/p/5923232.html 先说一下我的经历,以及解决问题的而过程. 在使用SpringMVC的时候,最开始的时候在配置文 ...

  7. [Spring MVC] - JSON

    Spring MVC中使用JSON,先必需引用两个包:jackson-core-asl-1.9.13.jar.jackson-mapper-asl-1.9.13.jar 因为需要使用到jquery测试 ...

  8. spring mvc 中文乱码 post与get的方法解决

    spring mvc表单提交中文参数乱码问题 今天测试spring mvc  ,中文乱码,在web.xml中加上 <filter> <filter-name>encodingF ...

  9. Spring MVC JSON 实现JsonSerializer Date类型转换

    转载至:http://blog.csdn.net/lantianzhange/article/details/40920933 在Spring MVC中存在两大类的类型转换,一类是Json,一个是Sp ...

随机推荐

  1. JDBC中执行SQL语句的方式

    一.执行DDL.DML语句 DDL.DML分别表示数据库定义语言.数据库操纵语言,操控这两种语言应该使用Statement对象的executeUpdate方法. 代码如下: public static ...

  2. Visual C++ 6.0中if的简单用法

    # include<stdio.h> int main (void) { > ) printf("AAAA"); printf("BBBB") ...

  3. python 11

    # 一.闭包 # # 判断:函数名.__closure__ # 若返回cell,则是闭包,返回None则不是闭包. # # 闭包:内层函数对外层函数非全局变量的引用就叫闭包. def func1(x) ...

  4. python学习6---字典合并

    1.针对python3版本 d1={'gao':1,'luo':2} d2={'liu':3,'jia':4} dictMerged1=dict(d1,**d2) print(dictMerged1) ...

  5. css的各种动画

    /*淡入*/@keyframes fade-in { 0% { opacity: 0; } /*初始状态 透明度为0*/ 40% { opacity: 0; } /*过渡状态 透明度为0*/ 100% ...

  6. mybatis:Parameter 'ids' not found.

    https://www.cnblogs.com/baby-lijun/p/5908088.html ps:根本原因就是他们根本就没有理解foreach里面的collection应该放什么东西,错误的理 ...

  7. c语言设计实验报告

    试验项目:1.字符与ASCLL码 2.运算符与表达式的运用 3.顺序结构应用程序 4.数学函数的算法描述 5.鸡兔同笼的算法描述 6.确定坐标的算法描述 姓名:熊承启 实验地点:514实验室 1.字符 ...

  8. 2.7 while 、for 循环控制语句

    一.while语句: 在程序中,需要重复性的做某件事: 1.1.1 while: public class Test{ public static void main(String[] args){ ...

  9. python numpy模块使用笔记(更新)

    np.arange(int a) 生成一个一维array,元素个数是a个,元素是0到a-1 注意arange不能直接生成多维array np.arange(int a).reshape(int b,i ...

  10. 截取所有的winform runtime error

    https://stackify.com/csharp-catch-all-exceptions/ AppDomain.CurrentDomain.FirstChanceException += (s ...