Auto-configured JacksonJsonpMapper is conditional on an ObjectMapper bean but does not use such a bean#36109
Auto-configured JacksonJsonpMapper is conditional on an ObjectMapper bean but does not use such a bean#36109Pengfei-Lu wants to merge 1 commit intospring-projects:mainfrom
Conversation
|
I don't figure it out how to mock the "ObjectMapper class is not loaded" senario, thus deleting the two failed Is there any better solution? |
|
You should be able to use |
It works! Please review the code. |
wilkinsona
left a comment
There was a problem hiding this comment.
Thanks for the updates, @Pengfei-Lu. I think ElasticsearchClientAutoConfiguration could also be updated as it no longer needs to be ordered after JacksonAutoConfiguration. Could you do that as well please?
…bean but does not use such a bean. Signed-off-by: Pengfei-Lu <459360594@qq.com>
Done. Please check. |
|
@wilkinsona If there is any update, please let me know, thanks! |
See gh-36109 Signed-off-by: Pengfei-Lu <459360594@qq.com>
|
Thanks very much for the PR, @Pengfei-Lu. |
Spring Boot version
3.1.1
Bug description
The autoconfigured JacksonJsonpMapper bean used to depend on a global
ObjectMapperbean before SpringBoot version v3.0.3.After this commit introduced by SpringBoot version v3.0.3, the global
ObjectMapperbean is not required when creatingJacksonJsonpMapperbean.However, the
JacksonJsonpMapperbean creation condition@ConditionalOnBean(ObjectMapper.class)is not changed, resulting inJacksonJsonpMapperbean can be created only when ObjectMapper bean is present instead of the ObjectMapper class.Bug resolving solution
Change
@ConditionalOnBean(ObjectMapper.class)to@ConditionalOnClass(ObjectMapper.class)