spring-boot health not showing details withDetail info
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
If you call withDetail(...) in a custom Spring Boot health indicator but /actuator/health still shows only UP or DOWN, the problem is usually not the indicator itself. In most cases, the details were added correctly, but Actuator is configured not to expose them to the current caller.
What withDetail Actually Does
A custom indicator can attach extra information to the Health object it returns.
That code does create health details. The missing piece is whether the actuator endpoint is allowed to show them.
Actuator Hides Details by Default
Spring Boot does this for security reasons. A health endpoint visible to load balancers or anonymous users should not automatically reveal internal system details.
The main property is:
Other common values are:
- '
never' - '
when-authorized' - '
always'
If the property is never, or if it is when-authorized and the request is not authenticated with the required role, your custom details will stay hidden even though withDetail(...) worked.
Expose the Endpoint and Authorize It Correctly
You also need the endpoint to be exposed.
With that setup, only authorized users with the configured role see the detail payload.
If you are using Spring Security, your security config must also allow the request pattern you expect.
Health Groups Can Change What You See
Another source of confusion is health groups. If you call /actuator/health/readiness or another grouped endpoint, the response may differ from the root /actuator/health endpoint depending on which indicators are included in that group.
So if your custom indicator is not showing up where you expect, check:
- which endpoint URL you are calling
- whether the indicator belongs to that health group
- whether group-specific config overrides the default behavior
Verify the Indicator Is Actually Registered
If the endpoint shows no custom component at all, make sure Spring created the bean. A simple @Component on the health indicator is usually enough, but package scanning, conditional config, or profile restrictions can still prevent registration.
One quick test is to look for the indicator's contribution in logs or call the actuator endpoint after temporarily setting show-details=always in local development. Also remember that infrastructure probes often should stay minimal; detailed health is usually for secured human-facing diagnostics rather than every anonymous request.
If you return several details and none appear, try simplifying the indicator to a single obvious field such as withDetail("probe", "seen"). That helps distinguish between a registration problem and a visibility-policy problem. Once that works, add the real details back.
Common Pitfalls
The biggest mistake is assuming withDetail(...) forces the health endpoint to expose those fields publicly. It does not.
Another mistake is testing /actuator/health anonymously while the app is configured to show details only when authorized.
A third mistake is debugging the indicator code when the real issue is endpoint exposure, security, or health-group configuration.
Summary
- '
withDetail(...)adds data to theHealthobject, but Actuator may still hide it.' - Check
management.endpoint.health.show-detailsfirst. - Make sure the health endpoint is exposed and your security rules allow the intended caller.
- Verify that you are calling the correct health endpoint or health group.
- If needed, temporarily use
show-details=alwaysin local development to confirm the indicator is working.
Related reading
- Spring-Boot logging to Kafka how to eliminate warning; best practices
- Spring-Boot logging with log4j2?
- Spring Actuator + Kafka Streams - Add kafka stream status to health check endpoint
- Spring actuator's liveness and readiness are returning 404
- Spring-Boot How do I set JDBC pool properties like maximum number of connections?
- Spring-Boot How to properly inject javax.validation.Validator
- Spring-Data-MongoDB Failed to convert from type after upgrade to 2.0.7 with custom converter
- Spring - No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.