Return a small status to routine probes while limiting component names and failure details to authorized operators.
Spring health details: status for probes, diagnostics for operators
Health has two audiences
A scheduler wants a quick answer about whether a receipt instance can receive traffic. An operator may need to know which contributor is failing. A public probe response should not casually disclose database names, broker topology or exception text. The health show-details and show-components settings control how much information the endpoint returns; an authorization rule still determines who can call it. Readiness answers admission to traffic, while health design decides what each indicator measures.
Separate failure domains
Do not make liveness depend on a remote payment processor. A temporary remote outage is not proof that restarting the JVM will help, and a restart loop can amplify the outage. A readiness group may include a dependency if this instance truly cannot serve any request without it, but that decision can remove all instances at once during a shared failure. Put nonessential dependency signals in an operator-facing diagnostic group.
Verify both views
Call the probe path without credentials and inspect the exact response body. Then call the operator path with and without the permitted role. Assert that unauthorized output omits contributor details and that the authorized view identifies a forced failing contributor. Run the check behind the real proxy because path rewriting and separate management ports alter which rule sees the request. Keep indicator work bounded so a stalled dependency cannot occupy every probe worker.
Implementation contract
management.endpoint.health.show-details=when-authorized
management.endpoint.health.show-components=when-authorized
management.endpoint.health.roles=OPSCost and verification
More health contributors add probe latency and may consume connection-pool slots. A deeply detailed response also increases the information exposed to anyone who can call that endpoint; cache or bound expensive diagnostics separately.
Common Mistakes
- Do not expose all health details to a public load balancer probe.
- Do not add every remote dependency to liveness.
- Do not assume a role setting replaces an explicit request authorization policy.
Read next
Spring Boot Actuator health: public liveness without public diagnostics, Spring readiness: report an unavailable dependency without forcing liveness failure, Spring Actuator management port: separate listener, explicit access rule, Spring Prometheus scrape endpoint: registry, exposure and label contract, Spring Security filter chain: authentication, CSRF and request order.
