From 4b31feb2438a7e542b0995a341041f6ae99490b0 Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Mon, 6 May 2019 22:09:56 +0200 Subject: [PATCH] Clarify Jackson2ObjectMapper.modules(ToInstall) semantics Closes gh-22747 --- .../http/converter/json/Jackson2ObjectMapperBuilder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java index 433fef384dc..07307713239 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java @@ -497,6 +497,8 @@ public class Jackson2ObjectMapperBuilder { /** * Specify one or more modules to be registered with the {@link ObjectMapper}. + * Multiple invocations are not additive, the last one defines the modules to + * register. *

Note: If this is set, no finding of modules is going to happen - not by * Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}). * As a consequence, specifying an empty list here will suppress any kind of @@ -512,6 +514,8 @@ public class Jackson2ObjectMapperBuilder { /** * Set a complete list of modules to be registered with the {@link ObjectMapper}. + * Multiple invocations are not additive, the last one defines the modules to + * register. *

Note: If this is set, no finding of modules is going to happen - not by * Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}). * As a consequence, specifying an empty list here will suppress any kind of @@ -529,6 +533,8 @@ public class Jackson2ObjectMapperBuilder { /** * Specify one or more modules to be registered with the {@link ObjectMapper}. + * Multiple invocations are not additive, the last one defines the modules + * to register. *

Modules specified here will be registered after * Spring's autodetection of JSR-310 and Joda-Time, or Jackson's * finding of modules (see {@link #findModulesViaServiceLoader}), @@ -545,7 +551,8 @@ public class Jackson2ObjectMapperBuilder { /** * Specify one or more modules by class to be registered with - * the {@link ObjectMapper}. + * the {@link ObjectMapper}. Multiple invocations are not additive, + * the last one defines the modules to register. *

Modules specified here will be registered after * Spring's autodetection of JSR-310 and Joda-Time, or Jackson's * finding of modules (see {@link #findModulesViaServiceLoader}),