Jackson2ObjectMapperBuilder
breaks when modules
customizer follows modulesToInstall
#30751
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
In Spring 5.3, to address this issue, Spring added a new API here. It is supposed to be used like this:
Sadly, if you add exactly that configuration along side
JacksonAutoConfiguration
, Spring Boot would break with an unhingedjava.lang.UnsupportedOperationException: null
. This is due to the following lines inJacksonAutoConfiguration
:The cause is the implementation of
Jackson2ObjectMapperBuilder.modulesToInstall(Module...modules)
, particularly this line:Spring will reuse
this.modules
and use it when you callbuilder.modules(Consumer<List<Module>>)
causing the exception.A solution should be easy, we can either patch
JacksonAutoConfiguration
or on Spring side.Currently, for a workaround, it is reasonable to make do with:
The text was updated successfully, but these errors were encountered: