Spring Boot Actuator A Production Grade Feature in Spring Boot

Spring Boot Actuator is one of the greatest and most useful feature in Spring Boot framework. Actuator module in spring boot helps application developers to implement the production grade features like metrics, health check, security, etc. with minimal effort.

This article will guide you through how to enable the spring boot actuator, configure endpoints and how to modify the default settings in the application.properties file. Note that spring boot actuator can work only for the spring boot application, this can not be integrated to the non-spring boot applications.

List of Endpoints Supported

Here is the list of actuator endpoints that is supported at the time of writing this article. There will be new features added to the endpoints for every new release. In this article I would explain few of the endpoints that are very commonly used in the production environment.

  • actuator
  • autoconfig
  • beans
  • configprops
  • dump
  • env
  • health
  • info
  • metrics
  • mappings
  • shutdown
  • trace
  • logfile
  • flyway
  • liquibase

How to enable actuator endpoints?

By default, actuator endpoints are enabled to your spring boot applications. But, it is very simple to enable actuator feature in your application. If you add the required dependency to your pom.xml file, then that will enable the actuator feature to your application.


Once you have added the above entries in your pom.xml file, restart the application. It will be enabled. Note that, there are multiple endpoints in the actuator module. Only few of them enabled by default and only few of them are accessible to anonymous user. Some of the endpoints would have security protection to prohibit unauthorized access. This configurations can be modified to change the behaviour of each endpoints.

Endpoints Configuration

Each endpoints have the configurations that are enabled with default configurations at the application start up. One of the important attribute for the endpoint is “sensitive”, if the value of this attribute is “false”, this implies that this endpoint can be accessed without any authentication. If the value is “true”, then you have to add the Spring Security module in the class path to access the endpoints. This values also can be configured in the application.properties file.

Here is an Example of Configurations

information.app.name=Actuator Example
information.app.description=Actuator Example


The default URI for this endpoint is /metrics. This endpoint will be enabled by default when you are adding the spring boot actuator module in the classpath. As the name of the endpoint itself indicates that this feature will be useful for finding the information about memory, heap, processor, class loading and thread pool.

We can classify the metrics as system metrics, datasource metrics, cache metrics and session metrics. Also application developer can add their own metrics implementation to their spring boot application.

If you could run the application and access the endpoint URI at /metrics, you would get the JSON response like the one below:



It is important for any production application to periodically to check if the application is up or down. This endpoint facilitate that requirement by exposing a endpoint URI /health which returns the status message for your application. When you access the URI, you would get the response message like the one below:

{ "status" : "UP"

The above message indicates that the application is currently running without any issues. This service can be used by monitoring tools to check and alert if the application is not running.


Info endpoint is exposed by default at URI /info. If you access this endpoint, it displays the information about the application. Look at the following configurations:

info.app.name=Spring Boot Actuator Sample Application
info.app.description=Spring Boot Actuator Sample Application

The above configuration modifies the default endpoint info to information. Also sets the applications details name, description and version. The sensitive attribute of the endpoint ensures that corresponding endpoint can be made public or requires authentication. Another attribute enabled is to ensure if you want to expose that endpoint or not.

If you could run the application and access the endpoint as /information, you would see the following information displayed as JSON format.

   “description”:“Spring Boot Actuator Sample Application”,
   “name”:“Spring Boot Actuator Sample Application”,

Example Application

I have written a very simple example application to demonstrate the spring boot actuator functionality. You can just following these steps to complete the setup of your first spring boot actuator application.

Create a Maven Project

First step is to create a maven project. The final package structure for the example application would be similar to the one below:

Create Maven Build File

Create a pom.xml file and add the following entries to the maven build file.

project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<name>boot-sample Maven Webapp</name>

Create Spring Boot Application File

Spring Boot application starter file is used for running the spring boot application. This class has to be annotated with the @SpringBootApplication annotation.


package spring.boot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
public class Application {
   public static void main(String[] args) {
   SpringApplication.run(Application.class, args);

Create Application Properties File

This file is the important spring boot configuration file for loading custom configurations.


info.app.name=Spring Boot Actuator Sample Application
info.app.description=Spring Boot Actuator Sample Application

Run Spring Boot Actuator Example Application

Once you have build the project, just right click on the Application.java file to start the spring boot application. When you are starting your application, the actuator endpoint will be enabled. Here is the URL to access the actuator endpoints and screenshots of the example application.




In this article I have explained the key concepts about the spring boot actuator and provided simple example to demonstrate how to enable the enspoints and also configured few endpoints like infor, metrics and health. In the similar way you will be able to configure any other endpoints supported by the actuator module.

Published on 17-Jan-2020 11:38:12