Skip to content

Commit 4b31feb

Browse files
committed
Clarify Jackson2ObjectMapper.modules(ToInstall) semantics
Closes gh-22747
1 parent 293188c commit 4b31feb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ public Jackson2ObjectMapperBuilder featuresToDisable(Object... featuresToDisable
497497

498498
/**
499499
* Specify one or more modules to be registered with the {@link ObjectMapper}.
500+
* Multiple invocations are not additive, the last one defines the modules to
501+
* register.
500502
* <p>Note: If this is set, no finding of modules is going to happen - not by
501503
* Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
502504
* As a consequence, specifying an empty list here will suppress any kind of
@@ -512,6 +514,8 @@ public Jackson2ObjectMapperBuilder modules(Module... modules) {
512514

513515
/**
514516
* Set a complete list of modules to be registered with the {@link ObjectMapper}.
517+
* Multiple invocations are not additive, the last one defines the modules to
518+
* register.
515519
* <p>Note: If this is set, no finding of modules is going to happen - not by
516520
* Jackson, and not by Spring either (see {@link #findModulesViaServiceLoader}).
517521
* As a consequence, specifying an empty list here will suppress any kind of
@@ -529,6 +533,8 @@ public Jackson2ObjectMapperBuilder modules(List<Module> modules) {
529533

530534
/**
531535
* Specify one or more modules to be registered with the {@link ObjectMapper}.
536+
* Multiple invocations are not additive, the last one defines the modules
537+
* to register.
532538
* <p>Modules specified here will be registered after
533539
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
534540
* finding of modules (see {@link #findModulesViaServiceLoader}),
@@ -545,7 +551,8 @@ public Jackson2ObjectMapperBuilder modulesToInstall(Module... modules) {
545551

546552
/**
547553
* Specify one or more modules by class to be registered with
548-
* the {@link ObjectMapper}.
554+
* the {@link ObjectMapper}. Multiple invocations are not additive,
555+
* the last one defines the modules to register.
549556
* <p>Modules specified here will be registered after
550557
* Spring's autodetection of JSR-310 and Joda-Time, or Jackson's
551558
* finding of modules (see {@link #findModulesViaServiceLoader}),

0 commit comments

Comments
 (0)