To integrate Spring Boot with Actuator, add the spring-boot-starter-actuator dependency, expose the endpoints you need with management.endpoints.web.exposure.include, and secure them. Actuator then serves health, metrics, environment and info data under /actuator, and Micrometer lets you export those metrics to systems such as Prometheus.
This guide targets Spring Boot 3.x (Java 17 or newer). By default only /actuator/health is exposed over HTTP, so you decide explicitly what leaves the application.
Add the starter to your build file. The version is managed by the Spring Boot BOM.
For Gradle:
Start the application and open http://localhost:8080/actuator. It lists the endpoints that are currently exposed, and with no extra configuration that is only health.
Endpoints can be enabled and exposed independently. An endpoint that is not exposed over the web cannot be called remotely, even if it exists in the application.
The most useful built-in endpoints are:
| Endpoint | Purpose |
|---|---|
health | Aggregated status of the app and its dependencies (database, disk, message broker) |
info | Build, git and custom application information |
metrics | Names and values of Micrometer metrics |
prometheus | Metrics in Prometheus text format (needs the Prometheus registry) |
loggers | View and change log levels at runtime |
env and configprops | Configuration properties (sensitive, never expose publicly) |
threaddump and heapdump | Diagnostics for performance problems |
Avoid include: "*" in production. It exposes env, heapdump and other endpoints that can leak secrets or memory contents.
/actuator/health returns {"status":"UP"} when every health indicator is healthy and DOWN (HTTP 503) otherwise. Spring Boot auto-configures indicators for the beans it finds, such as DataSource, Redis, RabbitMQ and disk space.
With management.endpoint.health.probes.enabled=true you also get /actuator/health/liveness and /actuator/health/readiness, which map directly to Kubernetes liveness and readiness probes. Spring Boot enables them automatically when it detects a Kubernetes environment.
You can add your own check by implementing HealthIndicator:
The indicator name is the bean name without the HealthIndicator suffix, so this one appears as paymentGateway in the response.
Actuator uses Micrometer, a vendor-neutral metrics facade. Out of the box you get JVM memory, garbage collection, thread, CPU, HTTP server request and datasource pool metrics. Call /actuator/metrics for the list and /actuator/metrics/http.server.requests for one metric.
To scrape with Prometheus, add the registry:
Then /actuator/prometheus serves the data. You can record your own metrics by injecting a MeterRegistry:
Keep tag values low-cardinality (channels, status codes), never user IDs, or your metrics backend will grow without bound.
Treat Actuator as an operational interface. Two common approaches work well. First, run it on a separate management port that is not reachable from the internet:
Second, protect it with Spring Security. With Spring Security on the classpath, Actuator endpoints other than health and info require authentication by default once you define your own SecurityFilterChain, so state the rule explicitly:
Only health is exposed over HTTP by default. Add metrics to management.endpoints.web.exposure.include.
Set management.endpoints.web.base-path, for example to /internal. You can also move Actuator to its own port with management.server.port.
Yes. Expose the loggers endpoint and send a POST with {"configuredLevel":"DEBUG"} to /actuator/loggers/com.example.
The overhead is small. Metric collection is cheap, but expensive custom health checks run on every call to the health endpoint, so keep them fast.
Add the Actuator starter, expose only the endpoints you need, and use health probes for Kubernetes. Micrometer provides metrics, and the Prometheus registry makes them scrapeable. Always restrict access to Actuator with a separate port, Spring Security, or both.