Health Indicators
Report application and dependency health.
Health Indicators is a free Spring Boot 4 Microservices & REST APIs lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Spring Boot 4 Microservices & REST APIs learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Health Endpoint
The /actuator/health endpoint reports whether the application and its dependencies are functioning. Load balancers and orchestrators poll it to decide if an instance should receive traffic.
GET /actuator/health
{ "status": "UP" }Aggregated Status
Overall health is an aggregate of many health indicators. If any critical indicator reports DOWN, the overall status becomes DOWN. Statuses include UP, DOWN, and OUT_OF_SERVICE.
Built-in Indicators
Boot auto-configures indicators for common dependencies — datasource, disk space, Redis, RabbitMQ, and others — whenever the corresponding starter is present. They contribute to the aggregate automatically.
Showing Health Details
By default details are hidden. Reveal per-component breakdowns with management.endpoint.health.show-details, ideally only to authenticated callers.
management:
endpoint:
health:
show-details: when-authorized
# or: always / neverDetailed Output
With details enabled, the response lists each component’s status and contributed data, making it easy to see which dependency is failing.
{
"status": "UP",
"components": {
"db": { "status": "UP", "details": { "database": "PostgreSQL" } },
"diskSpace": { "status": "UP" }
}
}A Custom HealthIndicator
Implement HealthIndicator to report on a dependency Boot does not cover — say, a downstream API. Return Health.up() or Health.down() with optional details.
@Component
public class PaymentApiHealthIndicator implements HealthIndicator {
private final PaymentClient client;
public PaymentApiHealthIndicator(PaymentClient client) { this.client = client; }
@Override
public Health health() {
return client.ping()
? Health.up().withDetail("latencyMs", client.lastLatency()).build()
: Health.down().withDetail("reason", "ping failed").build();
}
}Indicator Naming
The component name is derived from the bean/class name with the HealthIndicator suffix stripped. PaymentApiHealthIndicator appears as paymentApi in the output.
Liveness and Readiness Probes
In Kubernetes you distinguish liveness (is the app alive?) from readiness (can it serve traffic?). Boot exposes both as health groups when probes are enabled.
management:
endpoint:
health:
probes:
enabled: true
# exposes /actuator/health/liveness and /readinessHealth Groups
Group indicators under a named subset so probes only consider the relevant checks. Readiness might include the database; liveness usually should not, to avoid pod restarts on transient outages.
management:
endpoint:
health:
group:
readiness:
include: db,paymentApiTuning Status to HTTP Codes
Actuator maps health statuses to HTTP codes — UP to 200, DOWN to 503 by default — so infrastructure can act on the response code without parsing the body.
Designing Good Health Checks
Keep checks fast and meaningful:
- Probe real dependencies, not just process liveness
- Avoid heavy work that itself causes failures
- Separate liveness from readiness to prevent restart storms
Quick Check
Test your understanding of custom indicators.
Recap
Health endpoints signal operational status.
/actuator/healthaggregates many indicators- Built-in indicators cover common dependencies
- Implement
HealthIndicatorfor custom checks - Use
show-detailswisely; names strip the suffix - Enable liveness/readiness probes and groups for Kubernetes
Frequently asked questions
Is the “Health Indicators” lesson free?
Yes — the full text of “Health Indicators” is free to read here on the web, and the Spring Boot 4 Microservices & REST APIs course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Spring Boot 4 Microservices & REST APIs course, upgrade to CoddyKit PRO.
What will I learn in “Health Indicators”?
Report application and dependency health. You practise Spring Boot 4 Microservices & REST APIs with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Spring Boot 4 Microservices & REST APIs?
No prior experience is required. Spring Boot 4 Microservices & REST APIs on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Health Indicators” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Spring Boot 4 Microservices & REST APIs lesson?
Yes. Every Spring Boot 4 Microservices & REST APIs lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.