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

來源:互聯網
上載者:User

標籤: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 failedorg.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包

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.