I am running Spring Boot v1.5.2.RELEASE.
How to have /health show below without disabling security for entire Spring Boot project?
{
"status": "UP",
"testing": {
"status": "UNKNOWN",
"foo": "bar"
}
}
Here is my code below for TestingHealthIndicator.java:
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health.Builder;
import org.springframework.stereotype.Component;
@Component
public class TestingHealthIndicator extends AbstractHealthIndicator {
@Override
protected void doHealthCheck(Builder builder) throws Exception {
builder.withDetail("foo", "bar");
}
}
"testing" shows in /health only if i set the following in application.properties
management.security.enabled=false
management.health.defaults.enabled=false
But I do NOT want to disable security for entire project.
I did see some helpful info here: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html, but did not see a specific way set custom AbstractHealthIndicator as non-sensitive.