Spring Boot Actuator Health Check Format
Design health check responses following Spring Boot Actuator conventions with component indicators, grouped health checks, and show-details configuration.
Detailed Explanation
Spring Boot Actuator Health Format
Spring Boot Actuator is the de facto standard for health endpoints in Java/Spring applications. Understanding its format helps when designing health checks for any framework.
Standard Actuator Response
{
"status": "UP",
"components": {
"db": {
"status": "UP",
"details": {
"database": "PostgreSQL",
"validationQuery": "isValid()"
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 107374182400,
"free": 68719476736,
"threshold": 10485760,
"path": "/.",
"exists": true
}
},
"redis": {
"status": "UP",
"details": {
"version": "7.2.3"
}
}
},
"groups": ["liveness", "readiness"]
}
Health Groups (Spring Boot 2.3+)
// GET /actuator/health/liveness
{
"status": "UP"
}
// GET /actuator/health/readiness
{
"status": "UP",
"components": {
"db": { "status": "UP" },
"redis": { "status": "UP" }
}
}
Configuration
management:
endpoint:
health:
show-details: when_authorized
show-components: when_authorized
group:
liveness:
include: livenessState
readiness:
include: readinessState,db,redis
health:
defaults:
enabled: true
Show Details Levels
| Level | Effect |
|---|---|
never |
Only status field |
when_authorized |
Details for authenticated users |
always |
Full details for everyone |
Custom Health Indicators
In Actuator, you implement the HealthIndicator interface for custom checks. Each indicator contributes to the overall status using the same UP/DOWN/OUT_OF_SERVICE/UNKNOWN semantics. This pattern is worth replicating in non-Spring frameworks.
Use Case
Java/Spring Boot applications using Actuator, or any framework that wants to follow the well-established Actuator health check conventions for interoperability with Spring-based monitoring tools.