#16 Spring Boot Actuator

Spring Boot Actuator is a powerful toolset for monitoring and managing Spring Boot applications. It provides various endpoints that offer insights into the application’s health, metrics, information, and more. This article will introduce you to Spring Boot Actuator, explain how to monitor and manage applications, and demonstrate the use of Actuator endpoints.

Monitoring and Managing Spring Boot Applications

Monitoring and managing applications is crucial for ensuring they run smoothly and efficiently. Spring Boot Actuator provides a set of built-in endpoints that allow you to monitor application health, view metrics, and access other important information.

Key Features of Spring Boot Actuator:

  1. Health Checks: Monitor the application’s health status.
  2. Metrics: Collect and view various metrics such as memory usage, CPU usage, and request counts.
  3. Application Information: Access details about the application’s build and environment.
  4. Custom Endpoints: Extend Actuator with custom endpoints for specific monitoring needs.

Getting Started with Actuator:

To start using Spring Boot Actuator, add the following dependency to your pom.xml or build.gradle file:




implementation 'org.springframework.boot:spring-boot-starter-actuator'

Once the dependency is added, Actuator endpoints are enabled by default. You can configure and customize them in the application.properties or application.yml file.

Using Actuator Endpoints

Actuator provides several built-in endpoints that offer valuable insights into your application. These endpoints are accessible via HTTP and can be customized for security and access control.

Common Actuator Endpoints:

  1. /actuator/health: Provides information about the application’s health status.
  2. /actuator/info: Displays general information about the application.
  3. /actuator/metrics: Shows various metrics collected by the application.
  4. /actuator/env: Displays environment properties.
  5. /actuator/beans: Lists all the beans in the application context.

Example Configuration in application.properties:


Accessing Actuator Endpoints:

With the default configuration, you can access the Actuator endpoints using HTTP requests. For example, to check the application’s health, send a GET request to /actuator/health.

Example Usage of Actuator Endpoints:

  1. Health Endpoint:
curl http://localhost:8080/actuator/health


  "status": "UP"

2. Metrics Endpoint:

curl http://localhost:8080/actuator/metrics


  "names": [

3. Info Endpoint:

curl http://localhost:8080/actuator/info


  "app": {
    "name": "MyApp",
    "version": "1.0.0"

Securing Actuator Endpoints:

By default, Actuator endpoints are exposed over HTTP, which may pose security risks if not properly protected. You can secure these endpoints using Spring Security.

Example Security Configuration:

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

public class SecurityConfig extends WebSecurityConfigurerAdapter {

    protected void configure(HttpSecurity http) throws Exception {

In this configuration, only users with the ADMIN role can access Actuator endpoints.

Custom Actuator Endpoints:

You can create custom Actuator endpoints to expose additional monitoring and management information specific to your application.

Example Custom Endpoint:

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

@Endpoint(id = "custom")
public class CustomEndpoint {

    public String customEndpoint() {
        return "Custom Actuator Endpoint";

This custom endpoint can be accessed at /actuator/custom.


Spring Boot Actuator is an invaluable tool for monitoring and managing Spring Boot applications. It provides a wealth of information through its built-in endpoints, allowing you to keep an eye on the health, metrics, and overall performance of your application. By securing these endpoints and extending Actuator with custom endpoints, you can ensure your application remains robust and secure. Actuator’s integration with Spring Boot makes it an essential component for maintaining and managing production-ready applications.

#SpringBoot #SpringActuator #Java #ApplicationMonitoring #AppManagement #HealthChecks #Metrics #DevOps #JavaDevelopment #SoftwareDevelopment #Programming #SpringFramework #Tech #LearnJava #Monitoring

Leave a Reply