DATAREST-899 - Prefer user registered modules over default ones.

We now issue the user registration of Jackson modules before any of the default modules Spring Data registers get applied. Testing module registration seems to be rather difficult as Jackson doesn't actually expose API to do so. An issue [0] was filed for Jackson to improve on this.

[0] https://github.com/FasterXML/jackson-databind/issues/1478
This commit is contained in:
Oliver Gierke
2016-12-20 12:51:01 +01:00
parent 839682d619
commit 4eeef2fee1

View File

@@ -828,6 +828,10 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// Configure custom Modules
configurerDelegate.configureJacksonObjectMapper(objectMapper);
objectMapper.registerModule(geoModule);
if (config().isEnableEnumTranslation()) {
@@ -835,8 +839,6 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
}
Jackson2DatatypeHelper.configureObjectMapper(objectMapper);
// Configure custom Modules
configurerDelegate.configureJacksonObjectMapper(objectMapper);
return objectMapper;
}