Spring Boot Actuator is a sub-project of the Spring Boot Framework. It provides additional features to help monitor and manage Spring Boot applications. These features include endpoints, metrics, and audit capabilities, making it an essential tool for production-ready applications. Actuator allows interaction and monitoring of the application through HTTP or JMX endpoints.
Actuator endpoints allow monitoring and interaction with the application. Spring Boot includes several built-in endpoints, and developers can create custom endpoints as needed. Each endpoint can be enabled or disabled individually.
- Example: The
/health
endpoint provides basic health information about the application. By default, it is mapped to/actuator/health
.
Key Highlights:
- Endpoints are accessible via HTTP, prefixed with
/actuator
. - Fully customizable and extendable.
Spring Boot Actuator provides dimensional metrics using Micrometer, an instrumentation library integrated into Spring Boot.
Key Features:
- Vendor-neutral interfaces for metrics like timers, gauges, counters, distribution summaries, and long task timers.
- A dimensional data model for flexible metric collection and reporting.
- Seamless integration with monitoring tools like Prometheus, Grafana, and CloudWatch.
Spring Boot Actuator includes a flexible audit framework to publish and manage application events via an AuditEventRepository
.
Key Features:
- Automatically publishes authentication-related events when Spring Security is active.
- Customizable for publishing additional application events.
To use Spring Boot Actuator, add the following dependency to your pom.xml
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
By default, only a few endpoints are enabled. You can configure which endpoints to enable in your application.properties
or application.yml
:
management.endpoints.web.exposure.include=*
To enable specific endpoints, list them explicitly:
management.endpoints.web.exposure.include=health,info
Once enabled, endpoints can be accessed using the /actuator
prefix. Example:
- Health endpoint:
http://localhost:8080/actuator/health
- Metrics endpoint:
http://localhost:8080/actuator/metrics
Contributions are welcome! Feel free to open issues or submit pull requests for improvements.