Skip to content

Commit 4eeef2f

Browse files
committed
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] FasterXML/jackson-databind#1478
1 parent 839682d commit 4eeef2f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -828,15 +828,17 @@ protected ObjectMapper basicObjectMapper() {
828828
objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
829829
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
830830
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
831+
832+
// Configure custom Modules
833+
configurerDelegate.configureJacksonObjectMapper(objectMapper);
834+
831835
objectMapper.registerModule(geoModule);
832836

833837
if (config().isEnableEnumTranslation()) {
834838
objectMapper.registerModule(new JacksonSerializers(enumTranslator()));
835839
}
836840

837841
Jackson2DatatypeHelper.configureObjectMapper(objectMapper);
838-
// Configure custom Modules
839-
configurerDelegate.configureJacksonObjectMapper(objectMapper);
840842

841843
return objectMapper;
842844
}

0 commit comments

Comments
 (0)