3
votes

I just add a spring-boot-starter-actuator dependency to pom.xml of my application. After building and running project, /health endpoint showing the next information:

{
   "status": "UP",
   "details": {
       "application": {
           "status": "UP"
        }
    },
    "application": {
        "status": "UP"
    }
}

How can I remove the "details" section from response?

1
which Spring version are you using?! Any special things in your codes? Default one, it just shows the: {"status":"UP"}.Kenny Tai Huynh

1 Answers

0
votes

Finally I found the root cause of the problem. It was incorrect configuration of MappingJackson2HttpMessageConverter:

@Autowired
public void configureJsonSerializer(MappingJackson2HttpMessageConverter objectMapperBuilder) {
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
    objectMapperBuilder.setObjectMapper(objectMapper);
}

The "details" field is private and stored in Health.class, but with this configuration it was added to final json response. I removed that and now everything works fine.