SpringMvc jackson NoSuchMethodError solution

Question: I recently learned mybatis and springmvc and reported an error when the spring controller returned the queried entity class json

java.lang.NoSuchMethodError: org.codehaus.jackson.map.SerializationConfig.isEnabled(Lorg/codehaus/jackson/map/SerializationConfig$Feature;)Z

It is jsckson that throws an exception when doing json conversion.

 

Solution: The test found that it was caused by the spring version and jackson version problem

3.2.5.RELEASE version spring jackson-mapper-asl version must be 1.9.11 or above

3.1.1.RELEASE version spring can use jackson 1.9.1 or above.

Since my version is:

wrote
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version> 3.2.5.RELEASE </version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version> 1.9.1 </version>
</dependency>

So incompatible, resulting in an exception.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327106849&siteId=291194637