Skip to content

Commit

Permalink
GH-1148 Copy the context ObjectMapper before modifying it
Browse files Browse the repository at this point in the history
Resolves #1162
  • Loading branch information
Lars Bilger authored and olegz committed Aug 15, 2024
1 parent 01c3fb0 commit 1cd93cb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ private JsonMapper gson(ApplicationContext context) {
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);
Expand Down

0 comments on commit 1cd93cb

Please sign in to comment.