Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Java Arrays
  • Java Strings
  • Java OOPs
  • Java Collection
  • Java 8 Tutorial
  • Java Multithreading
  • Java Exception Handling
  • Java Programs
  • Java Project
  • Java Collections Interview
  • Java Interview Questions
  • Java MCQs
  • Spring
  • Spring MVC
  • Spring Boot
  • Hibernate
Open In App
Next Article:
Spring Boot - Introduction to RESTful Web Services
Next article icon

Spring Boot Actuator

Last Updated : 29 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Developing and managing an application are the two most important aspects of the application’s life cycle. It is very important to know what is going on beneath the application. Also, when we push the application into production, managing it gradually becomes critically important. Therefore, it is always recommended to monitor the application both during the development phase and at the production phase. 

For the same use case, Spring Boot provides an actuator dependency that can be used to monitor and manage your Spring Boot application. Spring Boot Actuator is a key feature of Spring Boot, and with the help of this, developers can manage their application easily. By /actuator and /actuator/health endpoints, we can achieve the purpose of monitoring.

  • With the help of Spring Boot, we can achieve the above objectives.
  • Spring Boot's Actuator dependency is used to monitor and manage the Spring web application.
  • We can use it to monitor and manage the application with the help of HTTP endpoints or with JMX.

The image below demonstrates the structure of the Spring Boot Starter Actuator:

Spring-Boot-Starter-Actuator_

Advantages of Actuator Application

  • It increases customer satisfaction.
  • It reduces downtime.
  • It boosts productivity.
  • It improves Cybersecurity Management.
  • It increases the conversion rate.

1. Configuration for Actuator

In order to use hibernate validators, these configurations are necessary in your Spring Boot project.

1.1 Adding Actuator Dependency

To use the "Actuator", add the following dependency in your application’s project settings file.

For Maven (pom.xml):

<dependencies>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-actuator</artifactId>

</dependency>

</dependencies>


For Gradle (build.gradle):

dependencies {

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

}


1.2 Configuring Actuator in application.properties

Actuator provides several configuration options to customize its behavior. Below are some common configurations:

  • We can also change the default endpoint by adding the following in the application.properties file.

management.endpoints.web.base-path=/details

  • Including IDs/Endpoints

By default, all IDs are set to false except for 'health'. To include an ID, use the following property in the application.properties file.

management.endpoint.<id>.enabled

Example -> management.endpoint.metrics.enabled=true

  • List down all IDs that we want to include which are separated by a comma.

management.endpoints.web.exposure.include=metrics,info

  • Include only metrics and info IDs and will exclude all others ('health' too).

To add/include all ID information about our application, we can do it in the application.properties file by simply adding the following

management.endpoints.web.exposure.include=*

  • Excluding IDs/Endpoints

To exclude an ID or endpoint, use the following property and list out the respective IDs separated by a comma in the application.properties file.

management.endpoints.web.exposure.exclude

Example -> management.endpoints.web.exposure.exclude=info

Project Folder Structure:

The below image demonstrates the picture of how your project must look:

FolderStructure


2. Implementing the Project

2.1 Entity Class

UserEntity.java (Entity class representing the model data) is explained below:

  • This class acts as a simple java bean whose properties are returned as JSON response by the REST API's get() method.
  • 'Lombok' library is used to generate GETTER/SETTER methods automatically at runtime using '@Data' annotation.
  • '@RequiredArgsConstructor' annotation is used to generate a zero-argument constructor and if final or '@NonNull' fields are present, then respective arguments constructor is created.
  • To add the 'Lombok' library in your application, add the following dependency in your application's project build.
  • '@Component' annotation is used so that this bean automatically gets registered in Spring's application context.

Implementation:

Java
package gfg;  import lombok.Data; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component;  @Component @Data @RequiredArgsConstructor public class UserEntity {     String id = "1";     String name = "Darshan.G.Pawar";     String userName = "@drash";     String email = "drash@geek";     String pincode = "422-009"; } 



2.2 Controller

RESTfulController.java (A REST API controller) for defining APIs and testing the program.

This controller's get() method uses the UserEntity bean to return JSON response. UserEntiy bean is outsourced through '@Autowired' annotation which was registered in Spring's application context.

Java
package gfg;  import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;  @RestController @RequestMapping("/get") public class RESTfulController {      @Autowired     UserEntity entity;        @GetMapping("/data")        public UserEntity getEntity(){         return entity;     } } 


3. Testing Actuator APIs

3.1 Controller APIs

Here, the JSON Formatter Chrome extension is used to automatically parse the JSON body. Further, it will be required to work with "Actuator".

ControllerAPI


3.2 Working with Spring Boot Actuator APIs

To access the 'Actuator' services, you will have to use the HTTP endpoint as it becomes reliable to work with.

3.2.1 /actuator

It's simple just hit the default endpoint '/actuator', ensure that your Application is running.

Example:

ActuatorAPI


We can also change the default endpoint by adding the following in the application.properties file.

management.endpoints.web.base-path=/details

ActuatorAPI


3.2.2 /actuator/health

We can click on these above links and see the respective information. Additionally, we can activate other Actuator IDs and use them after '/actuator' to see more information. For example, 'health' ID is activated by default. Therefore we can click the link in the image or directly use 'http://localhost:8080/actuator/health'.

healthAPI


'UP' means the application's health is good.

Commonly Used Actuator Endpoints

There are a total of 25 IDs out of which the commonly used are listed out below:

EndpointID

Description         

beansDisplays a complete list of all the Spring beans in your application.
cachesExposes available caches.
conditionsShows conditions evaluated on configuration and auto-configuration classes.
healthShows application health information.
httptraceDisplays HTTP trace information (last 100 requests).
loggersShows and modifies the configuration of loggers in the application.
mappingsDisplays a collated list of all @RequestMapping paths.
sessionsRetrieves and deletes user sessions (requires Spring Session).
threaddumpPerforms a thread dump.

3.2.3 /actuator/beans

Actuatorbean


3.2.4 /actuator/mappings

ActuartorMapping



Including IDs/Endpoints

By default, all IDs are set to false except for 'health'. To include an ID, use the following property in the application.properties file.

management.endpoint.<id>.enabled

Example -> management.endpoint.metrics.enabled=true

OR, we can just list down all IDs that you want to include which are separated by a comma.

management.endpoints.web.exposure.include=metrics,info

This will include only metrics and info IDs and will exclude all others ('health' too). To add/include all ID information about our application, we can do it in the application.properties file by simply adding the following

management.endpoints.web.exposure.include=*

Output:

Output


Excluding IDs/Endpoints

To exclude an ID or endpoint, use the following property and list out the respective IDs separated by a comma in the application.properties file.

management.endpoints.web.exposure.exclude

Example -> management.endpoints.web.exposure.exclude=info

Use '*' in place of IDs in property to exclude all the IDs or endpoints.

Notes: 

  1. Before setting the management.endpoints.web.exposure.include, ensure that the exposed actuators do not contain sensitive information.
  2. They should be secured by placing them behind a firewall or are secured by something like Spring Security.

Next Article
Spring Boot - Introduction to RESTful Web Services

P

pawardarshan461
Improve
Article Tags :
  • Java
  • Geeks Premier League
  • Geeks-Premier-League-2022
  • Java-Spring-Boot
Practice Tags :
  • Java

Similar Reads

    Spring Boot Tutorial
    Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
    10 min read
    Introduction to Spring Boot
    Spring is widely used for creating scalable applications. For web applications, Spring provides Spring MVC, a commonly used module for building robust web applications. The major drawback of traditional Spring projects is that configuration can be time-consuming and overwhelming for new developers.
    5 min read
    Best Way to Master Spring Boot – A Complete Roadmap
    In the corporate world, they say "Java is immortal!". But Why? Java remains one of the major platforms for developing enterprise applications. Enterprise Applications are used by large companies to make money. Those applications have high-reliability requirements and an enormous codebase. According
    14 min read
    How to Create a Spring Boot Project?
    Spring Boot is built on top of the spring and contains all the features of spring. It is one of the most popular frameworks for building Java-based web applications and microservices. It is a favorite among developers due to its rapid, production-ready environment, which allows developers to focus o
    6 min read
    Spring Boot - Annotations
    Spring Boot Annotations are a form of metadata that provides data about a spring application. Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the
    7 min read
    Spring Boot - Architecture
    Spring Boot is built on top of the core Spring framework. It simplifies and automates Spring-based application development by reducing the need for manual configuration. Spring Boot follows a layered architecture, where each layer interacts with other layers in a hierarchical order. The official Spr
    3 min read
    Spring Boot Actuator
    Developing and managing an application are the two most important aspects of the application’s life cycle. It is very important to know what is going on beneath the application. Also, when we push the application into production, managing it gradually becomes critically important. Therefore, it is a
    5 min read
    Spring Boot - Introduction to RESTful Web Services
    RESTful Web Services REST stands for REpresentational State Transfer. It was developed by Roy Thomas Fielding, one of the principal authors of the web protocol HTTP. Consequently, REST was an architectural approach designed to make the optimum use of the HTTP protocol. It uses the concepts and verbs
    5 min read
    How to create a basic application in Java Spring Boot
    Spring Boot is the most popular Java framework that is used for developing RESTful web applications. In this article, we will see how to create a basic Spring Boot application.Spring Initializr is a web-based tool using which we can easily generate the structure of the Spring Boot project. It also p
    3 min read
    How to Create a REST API using Java Spring Boot?
    Representational State Transfer (REST) is a software architectural style that defines a set of constraints for creating web services. RESTful web services allow systems to access and manipulate web resources through a uniform and predefined set of stateless operations. Unlike SOAP, which exposes its
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences