您的位置:首页 > 编程语言 > Java开发

项目记事【SpringMVC-2】:将后台的对象,转成JSON报文

2017-08-31 10:34 127 查看

Spring版本:3.2.7

 

Jackson版本:

1 <bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
2     <!-- 解决 HttpMediaTypeNotAcceptableException: Could not find acceptable representation -->
3     <property name="supportedMediaTypes">
4         <list>
5             <value>text/html;charset=UTF-8</value>
6             <value>application/x-www-form-urlencoded;charset=UTF-8</value>
7             <value>application/json;charset=UTF-8</value>
8         </list>
9     </property>
10     <!-- 解决懒加载问题 -->
11     <property name="objectMapper">
12         <bean class="com.siebre.pms.actual.service.util.CustomMapper">
13         </bean>
14     </property>
15 </bean>
webmvc-config.xml

 

Over,问题解决!

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: