Spring Boot monitoring (Actuator endpoints)

One of the important thing is the monitoring of the production environment. And the Actuator endpoints will give us some capability to monitor the spring boot application. So for this we need to include the Actuator dependency in the pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">



And the next step will be to create the application.properties file in the resources folder:


And the last thing is to create the Application.java class which will run the Spring Boot Application:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);

By default it will use 8080 port. So you can use following endpoints:

  • /health – shows application health information
  • /beans – the list of all spring beans in the application
  • /metrics –  metrics like memory, processor, up time, committed heap, etc…

The full documentation you can fine here.

We can also enable/disable the individual endpoints. So let’s say that we want to disable all Actuator endoints, and enable only health endpoint. To do this we need to change the application.propeties file:

# disable all endpoints
# enable health endpoint