There is no @EnableActuator annotation in Spring Boot. The Actuator is enabled by adding the spring-boot-starter-actuator dependency, and Spring Boot's auto-configuration does the rest. Older articles that mention @EnableActuator are wrong, and code that imports it will not compile.
What you do control is which endpoints are exposed and how they are secured, through management.* properties. This article shows the correct setup and what people usually mean when they search for this annotation.
Spring Boot follows the convention of "add the starter and it works". The starter brings spring-boot-actuator-autoconfigure onto the classpath, which registers the endpoint infrastructure through auto-configuration, the same mechanism behind @SpringBootApplication. There is no @EnableActuator in org.springframework.boot.actuate or in any release of Spring Boot, including Spring Boot 3.x.
The @Enable... naming comes from older Spring Framework features such as @EnableCaching, @EnableScheduling and @EnableWebSecurity. Spring Boot replaces most of those with auto-configuration, and for Actuator there was never a need for one.
Add the starter.
Maven (pom.xml):
Gradle (Kotlin DSL):
Start the application and request the health endpoint:
No annotation and no configuration class are needed. By default only health is exposed over HTTP, which is a deliberate safe default.
Exposure is controlled in application.yml. Endpoints exist once they are enabled, but only the exposed ones are reachable.
| Endpoint | Purpose |
|---|---|
health | Liveness and readiness status, with component details |
info | Build and application information |
metrics | Micrometer metrics, listed by name |
prometheus | Metrics in Prometheus format (needs micrometer-registry-prometheus) |
loggers | View and change log levels at runtime |
env, configprops, beans | Diagnostics that can leak sensitive data |
Avoid include: "*" in production. Endpoints such as env, heapdump and threaddump reveal internals, so expose them only on a protected management port.
To enable or disable a single endpoint use management.endpoint.<id>.enabled, and since Spring Boot 3.4 you can also turn all of them off by default and opt in with management.endpoints.access.default=none and per-endpoint access settings.
Run management traffic on a separate port that is not published to the internet:
With Spring Security on the classpath, Actuator endpoints are protected like any other request. Allow the health probe publicly and require a role for the rest:
EndpointRequest matches the Actuator paths whatever base path you configure, so the rules survive a change to management.endpoints.web.base-path.
The annotations that do exist let you extend Actuator rather than enable it.
A custom health indicator:
A custom endpoint with @Endpoint, which exposes it at /actuator/features:
Remember to add features to management.endpoints.web.exposure.include. @ReadOperation, @WriteOperation and @DeleteOperation map to GET, POST and DELETE.
Nothing replaces it, because it never existed. Add spring-boot-starter-actuator and configure management.endpoints.web.exposure.include.
Spring Boot exposes only health over HTTP by default, so other endpoints do not leak data. Add the endpoint ids you want to the include list.
Set management.endpoints.web.base-path, for example to /internal. Security rules written with EndpointRequest adapt automatically.
Only health (without details) normally is. Put everything else on a separate management port or behind authentication.
There is no @EnableActuator annotation: add the Actuator starter and Spring Boot auto-configures it. Expose only the endpoints you need, move management traffic to a private port, secure it with Spring Security, and extend it with HealthIndicator beans and @Endpoint classes.