Reputation: 1078
We are using a custom Jackson 2 ObjectMapper that ignores invalid properties in JSON requests when serializing to a POJO. This odd thing is happening where after a build using Maven the custom ObjectMapper is being used as expected, and then other time it is not (seems to be using default maybe). The reason we know it isn't using the custom one is invalid properties are not being ignored during serialization and a 400 is being returned in our Jersey 2.9.1 resource. Does anyone have an idea why this may be happening and what could be done to fix it to always use the custom mapper?
pom file:
<!-- Start inherited dependencies -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.4.1.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.1.2</version>
</dependency>
Upvotes: 0
Views: 550
Reputation: 696
To me it sounds like an maven dependencies issue, one time your maven uses version 1 of dep A the other time it uses version 2 of dep A. Best way is to check your dependency tree and explicitly exclude all unwanted version in your pom file.
Upvotes: 2