码迷,mamicode.com
首页 > 移动开发 > 详细

Springmvc 中org.springframework.http.converter.json.MappingJackson2HttpMessageConverter依赖jackson包

时间:2017-08-24 13:31:24      阅读:347      评论:0      收藏:0      [点我收藏+]

标签:eth   pre   span   loader   cannot   4.0   ati   dex   init   

1,问题详情:Spring使用4.3.5.Release版本后

在SpringMvc配置文件中配置json 解析器后出现报错信息

 

[org.springframework.web.context.ContextLoader]Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0‘ 
... ...
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter] for bean with name ‘org.springframework.http.converter.json.MappingJacksonHttpMessageConverter#2aa148c0‘ 
... ...
Caused by: java.lang.ClassNotFoundException: org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
    ... ...

 

2.原因:

  Spring4.0后jackson依赖包不一样导致

3.解决方案

Spring 4.x.x版本后使用org.springframework.http.converter.json.MappingJackson2HttpMessageConverter所对应的jar

在maven配置jackson依赖包

 1        <dependency>
 2             <groupId>com.fasterxml.jackson.core</groupId>
 3             <artifactId>jackson-core</artifactId>
 4             <version>2.8.5</version>
 5         </dependency>
 6         <dependency>
 7             <groupId>com.fasterxml.jackson.core</groupId>
 8             <artifactId>jackson-databind</artifactId>
 9             <version>2.8.5</version>
10         </dependency>
11         <dependency>
12             <groupId>com.fasterxml.jackson.core</groupId>
13             <artifactId>jackson-annotations</artifactId>
14             <version>2.8.5</version>
15         </dependency>

 Spring 3.x.x版本后使用org.springframework.http.converter.json.MappingJacksonHttpMessageConverter

 所依赖的jackson包

1         <dependency>
2             <groupId>org.codehaus.jackson</groupId>
3             <artifactId>jackson-mapper-asl</artifactId>
4             <version>1.9.13</version>
5         </dependency>

 

Springmvc 中org.springframework.http.converter.json.MappingJackson2HttpMessageConverter依赖jackson包

标签:eth   pre   span   loader   cannot   4.0   ati   dex   init   

原文地址:http://www.cnblogs.com/lonecloud/p/7422425.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!