-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Auto-configured JacksonJsonpMapper is conditional on an ObjectMapper bean but does not use such a bean #36109
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Done. Please check. |
@wilkinsona If there is any update, please let me know, thanks! |
See gh-36109 Signed-off-by: Pengfei-Lu <[email protected]>
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
ObjectMapper
bean before SpringBoot version v3.0.3.After this commit introduced by SpringBoot version v3.0.3, the global
ObjectMapper
bean is not required when creatingJacksonJsonpMapper
bean.However, the
JacksonJsonpMapper
bean creation condition@ConditionalOnBean(ObjectMapper.class)
is not changed, resulting inJacksonJsonpMapper
bean 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)