在spring-mvc中使用json配置
来源:互联网 发布:金山词霸mac 屏幕取词 编辑:程序博客网 时间:2024/06/03 20:02
<!-- 返回json 方法二 需要导入 jackson-annotations.jar,jackson-core.jar,jackson-databind.jar-->
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html; charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html; charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</list>
</property>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html; charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html; charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
配置的前提是需要开启annotation 代码如下
<mvc:annotation-driven />
0 0
- 在spring-mvc中使用json配置
- Spring MVC JSON配置
- spring mvc中关于json的使用
- 【spring mvc】Spring MVC配置过滤器并在过滤器中使用bean
- 在asp.net mvc中使用json
- shiro在Spring MVC + hibernate 中配置
- 在Spring-MVC.xml中进行配置
- spring mvc json jackson 配置
- 在Spring MVC中使用FileUpload功能
- 在Spring MVC 中使用 flash attributes
- 在Spring MVC中使用FileUpload功能
- 在Spring MVC中使用Velocity
- 在spring MVC中使用RestTemplate
- 在 spring mvc 中使用 swagger2
- Spring mvc中使用Json最简单的方法
- 在SpringMVC中使用JSON的配置
- 如何 在Spring MVC中 使用多个Spring和MyBatis的xml配置文件(多模块配置)
- 在spring MVC中配置多个视图
- 萤火虫算法详解
- java同步机制的几种实现方式
- oracle在原来自段值得基础上追加字符串
- 初来乍到
- 星系炸弹
- 在spring-mvc中使用json配置
- LeetCode 算法刷题(10)
- 逻辑运算符
- 蓝桥杯
- java中MD5混淆
- 7 Oracle 管理用户和安全
- Windows下python模块发布
- StringUtils比String中多的方法
- ubuntu终端下几个实用工具