-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Actuator startup endpoint fails to serialize JSON when field visibility is set to 'any' #32297
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
This is somewhat related to #20291. I'm a little surprised that the same error isn't thrown during regular startup since @iaptekar Do you have the |
Yes I have jsr310 on the classpath. I am using it via spring-boot-starter-web. Though I have tried adding it as an extra dependency and even had a go at configuring the object mapper in a |
Jackson's message is misleading. It suggests adding We could address this without tackling #20291 by mapping the |
We might be able to use |
I have a branch at https://github.com/philwebb/spring-boot/tree/gh-32297 that shows how |
I like the approach. It seems low risk and addresses the problem without making a breaking change to public API. One for 3.1.12? |
Sorry guys If I probably go off topic in this thread, but using as a reference the #20291 and also the field visibility, the isolation isn't behaving probably properly? if you customize the Jackson2ObjectMapperBuilderCustomizer, for example: public Jackson2ObjectMapperBuilderCustomizer jacksonMapperBuilderCustomizer() {
return builder -> builder
.defaultTyping(ObjectMapper
.DefaultTypeResolverBuilder
.construct(ObjectMapper.DefaultTyping.NON_FINAL, LaissezFaireSubTypeValidator.instance)
.init(JsonTypeInfo.Id.CLASS, null)
.inclusion(JsonTypeInfo.As.PROPERTY));
} it will add the "_class" the json output of the /actuator endpoints, and for example it breaks "Intellij Actuator tab support", but the main issue is that shouldn't that be isolated? Thanks |
It's hard to say without some more context. If you believe you've found a bug related to Actuator's isolated object mapper, please open a new issue with a minimal sample that reproduces the problem and we can take a look. |
thanks! I'll create a new issue, I thought it was probably related to this. |
The last few comments have reminded me that, as of 3.0, this is only a problem when both |
that could be the same issue I'm being affected, because I have the default management.endpoints.jackson.isolated-object-mapper which is true, and by overriding it to true or leaving default, the changes I do to my Jackson2ObjectMapperBuilderCustomizer is being passed to the objectmapper on the actuator side., do you still think I should open another issue? |
Yes please, @joaquinjsb. It's better to keep things separate to begin with and to combine them if necessary than to start trying to track two potentially different problems in the same issue. |
I agree. |
I have a demo project using Spring Boot 2.7.3. The only dependencies are the web and actuator starters. I try to start the application with a
BufferingApplicationStartup
and setmanagement.endpoints.web.exposure.include=*
inapplication.properties
. This goes well and I can access startup metrics at/actuator/startup
.However, if I add the property
spring.jackson.visibility.field=any
toapplication.properties
and hit theactuator/startup
endpoint I get the following error:None of the other
spring.jackson
properties I tried caused this error. Is there perhaps an issue with theObjectMapper
initialization for the startup actuator?The text was updated successfully, but these errors were encountered: