Spring Boot Actuator

Spring Boot Actuator

Spring Boot provides actuator to monitor and manage our application. Actuator is a tool which has HTTP endpoints. when application is pushed to production, you can choose to manage and monitor your application using HTTP endpoints.

To get production-ready features, we should use spring-boot-actuator module. We can enable this feature by adding it to the pom.xml file.

  1. <dependencies>
  2.     <dependency>
  3.         <groupId>org.springframework.boot</groupId>
  4.         <artifactId>spring-boot-starter-actuator</artifactId>
  5.     </dependency>
  6. </dependencies>

We can also opt it while creating project by using starter wizard. Like:

Spring Boot actuator 1

It will do the same as we did explicitly in the pom.xml file.


Endpoints

Actuator endpoints allow us to monitor and interact with our Spring Boot application. Spring Boot includes number of built-in endpoints and we can also add custom.

The following table contains the available endpoints.

Id Description Sensitive default
actuator It provides a hypermedia-based “discovery page” for the other endpoints. It requires Spring HATEOAS to be on the classpath. True
auditevents It exposes audit events information for the current application. True
autoconfig It is used to display an auto-configuration report showing all auto-configuration candidates and the reason why they ‘were’ or ‘were not’ applied. True
beans It is used to display a complete list of all the Spring beans in your application. True
configprops It is used to display a collated list of all @ConfigurationProperties. True
dump It is used to perform a thread dump. True
env It is used to expose properties from Spring’s ConfigurableEnvironment. True
flyway It is used to show any Flyway database migrations that have been applied. True
health It is used to show application health information. False
info It is used to display arbitrary application info. False
loggers It is used to show and modify the configuration of loggers in the application. True
liquibase It is used to show any Liquibase database migrations that have been applied. True
Metrics It is used to show metrics information for the current application. True
mappings It is used to display a collated list of all @RequestMapping paths. True
shutdown It is used to allow the application to be gracefully shutdown. True
trace It is used to display trace information. True

For Spring MVC, the following additional endpoints can also be used.

Id Description Sensitive default
docs It is used to display documentation, including example requests and responses for the Actuator’s endpoints. False
heapdump It is used to return a GZip compressed hprof heap dump file. True
jolokia It is used to expose JMX beans over HTTP (when Jolokia is on the classpath). True
logfile It is used to return the contents of the logfile. True