-
Notifications
You must be signed in to change notification settings - Fork 41.2k
JacksonAutoConfiguration wipes out modules registered in Jackson2ObjectMapperBuilderCustomizers with higher precedence #39592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks, @hesselapplications. Our customizer is intentionally ordered at It's possible, although perhaps unlikely, that someone may be relying on the current behavior. If we switched to using the additive variant they may end up with Jackson using unwanted modules. As such, I think we may need to wait until 3.3 to make any changes here to avoid a potentially breaking change in a maintenance release. Out of interest, and to help us to understand how much of a problem this is for you, do you need to be able to configure the modules programatically or could you define them as beans so that the standard customizer registers them all? |
Yes additive modules do behave correctly with this approach
Our use case is we have an organization wide library included in every service. Within that we want to provide some org wide de/serialization defaults and custom modules via a customizer. We want the standard spring customizer to run after that so that the services can provide their own customizations on top of the org defaults in standard spring fashion. That way they are none the wiser to what is happening in the org library, no need to define their customizers at order library customizer + 1 I believe you are right that registering the modules as beans would allow our use case to work though. Thank you for the suggestion |
Superseded by #42836. |
If I provide a
Jackson2ObjectMapperBuilderCustomizer
with@Order(Ordered.HIGHEST_PRECEDENCE)
it gets applied before the boot default customizer inJacksonAutoConfiguration
. This is to be expected. What is not expected however is that the boot customizer wipes out any modules registered by higher precedence customizers.Believe the fix is to update this line to use the consumer variant introduced here
I am using boot 3.1.8
Thanks for everything you do.
The text was updated successfully, but these errors were encountered: