Introduction to Spring Boot Actuator
Introduction to Spring Boot Actuator
You have built the application — now how do you know it is running well? In production you need answers to questions like: Is the database connection alive? How much heap is the JVM consuming? How many HTTP requests has the server processed? Spring Boot Actuator answers all of these questions without any bespoke code on your part. It exposes a set of HTTP endpoints (and JMX beans) that surface the operational state of your application at runtime.
What Actuator Is
Actuator is a first-class Spring Boot module — a dependency you add once and an entire suite of endpoints appears. These endpoints are commonly called management endpoints and each one reveals a specific slice of operational data: health, metrics, environment variables, thread dumps, configuration beans, HTTP trace, and more. Rather than writing a custom /healthcheck route that pings the database, you get a battle-tested, pluggable implementation for free.
Adding Actuator to a Project
Add the starter to pom.xml (or the Gradle equivalent):
That is the only change required to enable Actuator. When the application starts you will see log lines like:
Only /actuator/health is exposed over HTTP by default. This conservative default is deliberate — some endpoints leak sensitive data and must be explicitly turned on.
Core Endpoints at a Glance
Actuator ships with over a dozen built-in endpoints. The most important ones for day-to-day production operations are:
/actuator/health— Aggregated health status (UP / DOWN / OUT_OF_SERVICE). Checks database, disk space, message brokers, and any custom indicator you register. This is what Kubernetes points its liveness and readiness probes at./actuator/info— Arbitrary application metadata: build version, git commit, environment properties. Populated fromapplication.propertiesorapplication.ymlunder theinfo.*namespace./actuator/metrics— Micrometer-powered metrics registry. Lists available metric names; drill into/actuator/metrics/{name}for values. Covers JVM memory, GC pauses, HTTP request counts, and more./actuator/env— The resolvedEnvironment— every property source (system properties, environment variables,application.yml) and their effective values. Sensitive values are masked by default./actuator/beans— The full list of Spring beans registered in the application context, their types, and dependencies./actuator/mappings— Every@RequestMappingregistered, including its handler method. Invaluable when debugging routing surprises./actuator/loggers— View and dynamically change log levels at runtime without restarting the application./actuator/threaddump— A snapshot of all JVM threads and their current stack traces. The first tool to reach for when diagnosing a deadlock or runaway thread./actuator/httptrace(renamed/actuator/httpexchangesin Spring Boot 3) — The last N HTTP request/response pairs. Requires a registeredHttpExchangeRepositorybean./actuator/shutdown— Gracefully stops the application via a POST request. Disabled by default and should stay that way on any publicly reachable server.
Enabling and Exposing Endpoints
Actuator distinguishes between an endpoint being enabled (the feature is active) and being exposed (reachable over HTTP or JMX). An endpoint can be enabled but not exposed. The default strategy is intentionally restrictive:
- All endpoints are enabled by default except
shutdown. - Only
healthis exposed over HTTP by default. - All endpoints are exposed over JMX by default (if JMX is on).
To expose additional endpoints, use management.endpoints.web.exposure.include:
/actuator/env and /actuator/beans can expose configuration values, class paths, and internal wiring that an attacker can exploit. Lesson 9 in this tutorial covers securing Actuator with Spring Security.
The Base Path and a Separate Management Port
By default, Actuator mounts all endpoints under /actuator. You can relocate this prefix:
For internal services it is common practice to serve the management endpoints on a completely separate port that is unreachable from the public internet — only reachable inside the Kubernetes cluster or VPC:
This is one of the cleanest architectural patterns for Actuator in production: your application serves traffic on port 8080 (or 443 behind a proxy), and your monitoring infrastructure calls port 8081 which is firewalled from the outside world.
How Actuator Integrates With the Rest of Your Stack
Actuator does not operate in isolation — it is designed to be consumed:
- Kubernetes — Configure
livenessProbeandreadinessProbeto call/actuator/health/livenessand/actuator/health/readiness(Spring Boot 3 splits these automatically when deployed in a Kubernetes environment). - Prometheus / Grafana — Add
micrometer-registry-prometheusand Prometheus scrapes/actuator/prometheus; Grafana displays dashboards. No extra code needed beyond the dependency. - Log aggregators —
/actuator/loggerslets you raise a log level toDEBUGon a live node to capture a specific failure, then lower it back — without a restart.
info endpoint to surface your build version. Add the spring-boot-maven-plugin build-info goal and your CI pipeline's git commit SHA. When an incident occurs, /actuator/info tells you exactly which build and which commit is running — invaluable in a fleet of containers where image tags may be ambiguous.
Summary
Spring Boot Actuator turns your application into a self-describing, observable service. With a single dependency you gain health checks, environment inspection, runtime metrics, live log-level changes, and thread dumps — everything an operations team needs to run and troubleshoot a service in production. The key discipline is knowing which endpoints to expose and how to protect them: by default only /actuator/health is visible, and for good reason. The subsequent lessons in this tutorial build on that foundation — customising health indicators, publishing Micrometer metrics, and locking down the management surface with Spring Security.