Spring Boot provides the Spring Boot actuator module for monitoring and managing your application when it is moved into production. Some of the production-ready features it provides are health monitoring of the application, auditing of the events, and gathering of metrics from the production environments.

For enabling the Spring Boot actuator, we need to add the following Spring Boot starter Maven dependency in pom.xml.


If you are using Gradle, then add the below dependency in the build.gradle :

dependencies {

Magic #1: the Base Path Can Be Changed

The actuator provides various built-in endpoints, and it also lets us add our own. The ID of the endpoint, along with a prefix of /actuator, is mapped to the URL. For example, the /info   endpoint will be mapped to  /actuator/info

The /actuator base path can be changed by configuring the management.endpoints.web.base-path property in the application.properties. For example: 


The above property changes the endpoint URL from /actuator/{ID} to  /mypath/{ID}. For example, the health endpoint will become /mypath/health.

Magic #2: Health of the Application

If we want to know the health of an application, we can use the health endpoint. For getting the health information, we just need to make a GET request to /actuator/health, as shown below.

$ curl 'http://localhost:8080/actuator/health' -i -X GET

The resulting response, by default, will be :

  "status" : "UP"

If we want to get the complete details of the health of the application, we can add the following property in application.properties.


The resulting response will be as shown below. If your application has a database like MongoDB, Redis, or MySQL, for instance, the health endpoint will show the status of those, which can also be seen below ( this is an example for Mongo):

            "message": "Hello I am UP"

Magic #3: Custom Health Indicators

The actuator provides a HealthIndicator and AbstractHealthIndicator interface, which we can implement to provide custom health indicators, as shown below.

public class MyHealthIndicator extends AbstractHealthIndicator {
    protected void doHealthCheck(Health.Builder builder) throws Exception {
        // Use the builder to build the health status details that should be reported.
        // If you throw an exception, the status will be DOWN with the exception message.
                .withDetail("app", "I am Alive")
                .withDetail("error", "Nothing!");

Now, our health endpoint is shown below.

            "app":"I am Alive",

Magic #4: Application Information With Info

The Spring Boot actuator provides the /info endpoint to display the information about the application. This is useful if you want to learn more about the version, name, and some other basic properties of the application. We can also display the Java version that your application uses. It takes the information from the Maven pom.xml file. Suppose you have the information in pom.xml, as given below.

<?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/maven-v4_0_0.xsd">

To expose the information using  /info, we can add the following properties in the application.properties file.


We will get the following information at the http://localhost:8080/actuator/info   endpoint.

    "app": {
        "name": "rahul_logging",
        "version": "1.0.0",
        "encoding": "UTF-8",
        "java": {
            "version": "1.8"

Magic #5: Metrics About the Application Environment

The application level metrics are exposed via the /metrics  actuator endpoint. This is useful if you want to the know the OS and JVM information of the application running in an environement. The information is as follows when we hit the application atlocalhost:8080/actuator/metrics:

    "names": [

If we want to look for a specific metric from the above result, actuator provides the information. For example, if want to see the JVM heap memory used, we can check at the endpoint  http://localhost:8080/actuator/metrics/jvm.memory.used. Then, it will display the following information:

    "name": "jvm.memory.used",
    "description": "The amount of used memory",
    "baseUnit": "bytes",
    "measurements": [
            "statistic": "VALUE",
            "value": 170223544
    "availableTags": [
            "tag": "area",
            "values": [
            "tag": "id",
            "values": [
                "Compressed Class Space",
                "PS Survivor Space",
                "PS Old Gen",
                "PS Eden Space",
                "Code Cache"


In this post, we looked at various features of the Spring Boot actuator, which provides us production-grade information like health, info, and other metrics. We have just scraped the surface of what the actuator will do for us. For further research and information, check the Spring Boot actuator official documentation.