GH-1148 Copy the context ObjectMapper before modifying it

Resolves #1162
This commit is contained in:
Lars Bilger
2024-07-17 10:25:20 +02:00
committed by Oleg Zhurakousky
parent 01c3fb07ef
commit 1cd93cb270

View File

@@ -216,12 +216,12 @@ public class ContextFunctionCatalogAutoConfiguration {
private JsonMapper jackson(ApplicationContext context) {
ObjectMapper mapper;
try {
mapper = context.getBean(ObjectMapper.class);
mapper = context.getBean(ObjectMapper.class).copy();
}
catch (Exception e) {
mapper = new ObjectMapper();
}
mapper.registerModule(new JavaTimeModule());
mapper.registerModule(new JavaTimeModule());
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_TRAILING_TOKENS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);