The HealthIndicator interface in Spring Boot Actuator is the contract for a single health check. Each bean that implements it returns a Health object saying whether a dependency such as a database, queue or external API is working, and Actuator aggregates all of them into the /actuator/health endpoint used by monitoring systems and load balancers.
Spring Boot already registers indicators for common infrastructure (database, disk space, Redis, Kafka and more). You implement HealthIndicator yourself when you need to check something specific to your application.
HealthIndicator lives in org.springframework.boot.actuate.health and has one method, health(), which returns a Health. Actuator discovers every bean of this type, calls it when the health endpoint is requested, and places each result under a key derived from the bean name with the HealthIndicator suffix removed.
The interface separates three concerns:
Health with a Status and details)A related interface, ReactiveHealthIndicator, returns Mono<Health> and is used by WebFlux applications so health checks do not block event-loop threads.
Spring Boot auto-configures an indicator when the matching library and bean are present. Common ones include:
| Key | Checks | Condition |
|---|---|---|
db | JDBC DataSource connectivity | A DataSource bean exists |
diskSpace | Free disk space against a threshold | Always on |
ping | Simple always-up check | Always on |
redis | Redis connection | Redis client present |
mongo | MongoDB status | MongoDB client present |
rabbit | RabbitMQ connection | RabbitMQ client present |
You can switch any of them off with management.health.<name>.enabled=false.
The example below checks that an external inventory service answers within a timeout. It reports UP with the measured latency, and DOWN with the exception when the call fails.
The result appears as inventoryService in the JSON. Configure a connect and read timeout on the HTTP client, because a hanging dependency would otherwise make the health endpoint hang too.
AbstractHealthIndicator removes the try and catch. You implement doHealthCheck(Health.Builder builder), and any exception it throws is converted to Health.down(ex) for you.
The StatusAggregator picks the worst status among all indicators using this default order: DOWN, OUT_OF_SERVICE, UP, UNKNOWN. A single failing indicator therefore turns the overall result to DOWN, and the endpoint returns HTTP 503. Change the order or HTTP mapping with management.endpoint.health.status.order and management.endpoint.health.status.http-mapping.
Use health groups to decide which indicators matter for a given consumer:
Then /actuator/health/readiness reports only the listed indicators. Kubernetes liveness probes should avoid external dependencies, otherwise a database outage restarts healthy pods.
An indicator is a plain class, so a unit test needs no Spring context. Assert on the returned Health.
The key is the bean name without the HealthIndicator suffix, so InventoryServiceHealthIndicator becomes inventoryService. Use @Component("customName") only if you need a different name, and keep the suffix.
By default yes, although some indicators cache results. Set management.endpoint.health.cache.time-to-live to cache the endpoint response and protect slow dependencies from frequent polling.
It should not be. Add timeouts to every remote call, keep checks lightweight, and avoid heavy queries, because load balancers and Kubernetes poll this endpoint often.
The interface is the same in both. Boot 3 requires Java 17 or newer and the jakarta namespace elsewhere, but HealthIndicator, Health and the configuration properties shown here are unchanged.
HealthIndicator is how you plug your own checks into Actuator. Return a Health from health(), let Spring Boot name and aggregate the results, and use health groups to separate readiness from liveness. Keep every check fast with explicit timeouts, expose details only to authorised callers, and cover custom indicators with simple unit tests.