We are still cooking the magic in the way!
Health Checks & Info Endpoints
Health Checks & Info Endpoints
When a service runs in production — behind a load balancer, inside a Kubernetes cluster, or managed by a container orchestrator — the infrastructure needs a reliable, machine-readable way to ask "is this instance healthy?". Spring Boot Actuator answers that need with two out-of-the-box endpoints: /actuator/health and /actuator/info. This lesson shows you exactly what they expose, how to control what they reveal, and how to write your own custom health indicator so the platform has full visibility into every dependency your application relies on.
The /actuator/health Endpoint
Add the Actuator starter to your pom.xml and the /actuator/health endpoint becomes available immediately:
A bare GET request to that URL returns a minimal JSON object:
The status can be UP, DOWN, OUT_OF_SERVICE, or UNKNOWN. The overall status is the worst status among all registered health indicators — if your database is DOWN, the whole endpoint reports DOWN, and load balancers that poll this URL will remove the instance from rotation.
Showing Component Details
To see each component's individual status, set one or both of these properties in application.properties:
With show-details=always a typical response looks like this:
Spring Boot auto-configures a health indicator for every technology it detects: DataSource, Redis, RabbitMQ, Kafka, MongoDB, Elasticsearch, and more. You get this coverage for free; you only need to write custom indicators for dependencies Boot does not know about.
Liveness and Readiness Probes
Kubernetes and other orchestrators distinguish two health concepts. Liveness asks "should this container be restarted?" (is the JVM stuck in a deadlock?). Readiness asks "should this instance receive traffic?" (is the application fully started and its dependencies reachable?). Boot exposes both as sub-paths of /actuator/health:
Or enable them both at once with:
Boot then exposes /actuator/health/liveness and /actuator/health/readiness separately. Point your Kubernetes liveness probe at the first URL and your readiness probe at the second.
Writing a Custom Health Indicator
Imagine your application calls an external payment gateway. Boot has no built-in indicator for it. Implement the HealthIndicator interface and register a Spring bean:
Boot names the component after the bean, stripping the HealthIndicator suffix. The bean above appears in the health response as "paymentGateway". You get full control of the details map and can pass any serializable value.
/actuator/health endpoint is polled continuously by orchestrators and load balancers — sometimes every few seconds. A health check that runs a complex query or waits on a slow network call will degrade performance and make the overall status unreliable. Use a cheap ping, a SELECT 1, or a lightweight status API call.
Reactive Health Indicators
If your application uses Spring WebFlux (reactive stack), implement ReactiveHealthIndicator instead so the check does not block the event loop:
The /actuator/info Endpoint
/actuator/info surfaces static metadata about your deployed artifact — version, build timestamp, git commit hash, custom properties. It is invaluable during an incident: one glance tells you exactly which build is running on every node without logging into any server.
First, expose the endpoint (it is disabled by default since Boot 2.6):
Then add key/value pairs under the info.* namespace:
The response mirrors the structure of these keys:
Build and Git Info via Maven/Gradle Plugins
The real power of /actuator/info comes from combining it with build plugins. The Spring Boot Maven plugin can generate a build-info.properties file at build time, and the git-commit-id plugin can embed the exact git SHA:
Enable the contributors in application.properties:
Now /actuator/info includes the build time, artifact version from your POM, the git branch, commit SHA, commit time, and whether the working tree was dirty at build time. A response might look like:
Custom InfoContributor
For dynamic info — say, the number of active feature flags or a runtime configuration summary — implement InfoContributor:
Summary
/actuator/health gives your infrastructure an authoritative liveness/readiness signal. Auto-configured indicators cover standard integrations; custom HealthIndicator beans cover everything else. Keep checks cheap and focused. /actuator/info embeds build and git metadata into the running artifact, turning every deployment into a self-describing artefact. Together, these two endpoints form the essential observability contract between your application and the platform it runs on. The next lesson expands the picture with Micrometer metrics.