jackson

2020-07-22  本文已影响0人  呆呆猿

ClassNotFound: com.fasterxml.jackson.databind.exc.InvalidDefinitionException

jackson版本要升级到 2.8.10

<dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.10</version>
      </dependency>

      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.9.5</version>
      </dependency>

springweb项目中引入了log4j日志可能会引起mvc视图映射器出问题,json对象无法返回,此时需要引入如上jar包
如果还是不行需要

<mvc:annotation-driven>
     <mvc:message-converters>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
   </mvc:message-converters>
</mvc:annotation-driven>

[图片上传中...(image.png-d64b6a-1595424853283-0)]

上一篇下一篇

猜你喜欢

热点阅读