Translate

четвер, 16 липня 2015 р.

Spring: migration from 3.x to 4.x issue



Today we’ve got such exception
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
quick investigation on Spring sources led us to issue with json serialization.
We use jackson for converting  from object to json behind the scene
For Spring 3.x we configured
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.4.2</version>
</dependency>

 

But Spring 4.x requires jackson v2
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.4</version>
</dependency>
 

Thx to Xavier Padró and his blog for hint

Also you can read more about json serialization in Spring 4.x on Spring official blog


Немає коментарів:

Дописати коментар