Spring Boot Actuator Tutorial

In this tutorial, we will learn about spring actuators. Also, we will see how it helps to monitor and manage your application seamlessly.


The actuator is a monitoring function provided by the Spring Boot framework. The actuator works by exposing endpoints, that can be used to monitor the internal conditions of the Spring Boot application, such as automatic configuration, spring beans information, health metrics, obtaining the current properties property values, threads information etc.

In the following sections, you will learn in detail how to enable the Spring Boot actuator in your application.


  • JDK 1.8
  • Intellij Idea for IDE
  • Maven
  • SpringBoot Application
  • Lombok plugin

Creating a Basic Spring Boot Application

Firstly, we create a simple Spring Boot web application.  Here, you can use the Spring Initializr page to create an initial project template.

Once you import the project into IDE, the final project structure will look like this:

project stucture

Include Dependencies

To include Spring Boot Actuator inside a REST API, we just have to add following maven starter dependency:

The complete source code of  “pom.xml” is as follow:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <description>Spring boot actuator tutorial</description>



Spring Boot Actuator

Once Maven dependency for the actuator is included, spring actuators are ready to consume. By default, the following two actuators are enabled at runtime and the remaining are disabled due to security reasons.

  • /actuator/health
  • /actuator/info

Here, /actuator/health endpoint allows us to test whether the Microservice is running or not. It is widely used in monitoring running instances of microservicesBy regularly checking this endpoint, you can expose the live status of your Microservices application. whereas, /actuator/info allows us to display the application-related info.

Let’s understand both of these endpoints in action.

First, we will compile and run our application using a standard process with the below command or directly executing the IDE run command.

mvn clean install
mvn spring-boot:run

once the application starts successfully. Next, you run the following URL in the browser,


As you can see, the application status is displayed as “UP” which means the app is running successfully.

actuator health output

Similarly for endpoint /actuator/info. We need to create application info data that will be exposed via this endpoint.

First, we will create file name application.properties inside /resources directory.

The complete source code for “application.properties”  file is as follow:

info.application.name=AppsDeveloper Blog demo
info.application.description=A Demo for Spring Boot Actuator
info.application.author.name= Sharad Dixit
info.application.author.bio= Software Developer

After compiling and re-runing our application again. If we navigate to the following actuator URL in the browser:


the browser will expose the application info as below:

Application information


As you can see, this actuator can provide application information for any microservice.

Enabling Hidden Endpoints

In addition to the above two actuators, spring allows us to activate another series of actuators that are already predefined. In order to activate the rest of the actuators endpoints, we have to go to our application.properties file and modify the following property and set it with the asterisk value as below:

management.endpoints.web.exposure.include = *

This property will expose all pre-defined lists of actuators. Although, this is not a good idea when your microservice is in production. Instead, we should choose specific endpoints to display.

Here, several methods are possible, but the easiest is to include only those that interest us in the property as below:


With this property, only these endpoints are exposed.

Now if we navigate to the following URL


Spring will display the list of exposed actuators provided by spring based on the property set. For example, if the property  “management.endpoints.web.exposure.include” is marked as *.

all endpoints

Below is the basic description of the most common endpoint actuator:

ID explanation Initial Value
autoconfig Shows all auto-config definitions true
beans Shows all beans managed by Spring. true
dump Provides thread dump details for each thread true
env Shows Spring’s ConfigurableEnvironment values. true
health Displays application health. false
info Shows application information. false
loggers Shows the log information used in the application. true
mappings The @RequestMapping definition shows the values ​​made. true
trace Lists the 100 most recently used HTTP requests. true


You can read in full detail about each endpoint in the official documentation here

Custom Endpoints

It is also possible to create custom endpoints based on individual requests. For example, if we want to create a dedicated endpoint into our application that shows the “Change-Log” for our application on each release. This can be achieved easily in Spring Boot Version 2 using @Endpoint annotation.

Next, we will create a class called “CustomActuator.java”  in our package which will be annotated with @component annotation to create a Spring-managed component. In this class, we will create a custom endpoint using @Endpoint annotation. Later via @ReadOperation (maps to HTTP GET), we read the response.
The complete code for CustomActuator.java is as follow:

package com.appsdeveloperblog;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.stereotype.Component;

public class CustomActuator {

    String changelog = "** version 2.0 ** \n\n"
            + "* Improved performance \n"
            + "* removed bug fix with local-id \n"
            + "* Added support of SAML authentication \n";

    public String changeLogs() {
        return changelog;

now if we run our application and navigate to our custom endpoint


After that, it will display me my change log details

custom actuator


In this tutorial, we learned how to use Spring Boot Actuator to check the status and metrics of your system. This helps developers to monitor the internals of Microservices. For example, health matrix, environment variables, performance, threads information etc. in the simplest way.   

Leave a Reply

Your email address will not be published.