升级spring到4.x的时候 jackson版本也需要升级,升级到2.7.5或者更高版本
<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.10.0</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.10.0</version> </dependency>
修改spring-mvc中转化json的bean配置
<!-- JSON配置--> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" > <property name="messageConverters"> <list> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" /> </list> </property> </bean>
将其中的
org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
修改为
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
还没有评论,来说两句吧...