Spring Boot includes several features to help us monitor and manage our application when it is in production. We can manage and monitor our application using HTTP endpoints or JMX. The HTTP endpoints are only available with a Spring MVC-based application like ours.
In Spring Boot terms this feature is called Actuators.
To enable the functionality, add the Actuator Starter to your pom.
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies>
The endpoints are configured automatically, and with sensitive defaults, i.e., the shutdown endpoint is disabled.
The actuator endpoints are provided under the path /application/ since Spring Boot 2. However, we can change the path by setting the property management.context-path in the application.properties.
By enabling this feature, we get multiple out of the box functionality exposed like:
We are not limited by the provided features but can either plug into them or create our own.
The health and metrics actuators are covered in Spring Boot: How To Get Started and Build a Microservice.