The spring boot actuator is another sub project for spring boot framework. It includes some of the features that help us to manage and monitor the spring boot applications. It provides us set of HTTP and JMX endpoints to manage and monitor the your spring boot application. If you want to develop the production grade application you have to include spring boot actuator in your spring boot application.
Features
There are three features in Spring Boot Actuator,
- Endpoints
- Metrics
- Audit
Endpoint
The Spring Boot Actuator provides us multiple built-in endpoints to monitor the your applications. And we can also add your own endpoint. Actuator allows us to enable or disable built-in end point. There are some properties, you just need to put it in your application properties file to enable or disable endpoint. You can access those endpoints over HTTP as given below.
Important Endpoints
- metrics http://localhost:8080/actuator/metrics
- Its display the information about using memory, free memory, threads, classes, system uptime etc..
- env http://localhost:8080/actuator/env
- Its display the used environment variables and properties.
- info http://localhost:8080/actuator/info
- Its display the application information.
- beans http://localhost:8080/actuator/beans
- Its display the spring beans and its scope and its dependency.
- health http://localhost:8080/actuator/health
- It shows the application health
Metrics
The micrometer is integrated into Spring Boot. It provides a vendor-neutral interfaces for timers, gauges, counters, distribution summaries, and long task timers with a dimensional data model.
Audit
Spring boot provides the audit framework, that public event to AuditEventRepository. It publishes the authentication event automatically if spring security is in execution.
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.properties
management.endpoints.web.exposure.include=* #// It will be include all actuator endpoints
management.endpoints.web.exposure.exclude= env #// It will be exclude the specified endpoints
#Enabale spring security
management.security.enabled=true
management.security.roles=ADMIN
security.basic.enabled=true
security.user.name=admin
security.user.passowrd=admin
