Spring Boot actuator endpoints

last modified July 31, 2023

In this article we show how to enable actuator endpoints in a Spring Boot application.

Spring Boot is a popular application framework for creating enterprise application in Java, Kotlin, or Groovy.

Actuator endpoints are used to provide information and monitor our applications. They are enabled with the spring-boot-actuator module.

The following is a partial is of built-in actuator endpoints.

The actuator endpoint returns a list of available endpoints. Endpoints are available for HTTP and JMX.

By default, only the health endpoint is enabled. We can enable endpoints via the management.endpoints.web.exposure.include property


Here we enable most endpoints with the star operator.


We can enable only specific endpoints.


Some endpoints, such as shutdown, must be enabled explicitly due to their sensitivity.

Spring Boot actuator example

The following application enables actuator endpoints.

│   ├───java
│   │   └───com
│   │       └───zetcode
│   │           │   Application.java
│   │           ├───actuator
│   │           │       MyEndpoint.java
│   │           └───controller
│   │                   HelloController.java
│   └───resources
│           application.properties

This is the project structure.

plugins {
    id 'org.springframework.boot' version '3.1.1'
    id 'io.spring.dependency-management' version '1.1.0'
    id 'java'

group = 'com.zetcode'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'

This is the Gradle build file. We include the spring-boot-starter-actuator module.


In the Application properties file, we enable the health, beans, env, and now endpoints. The now endpoint is a custom one.

package com.zetcode.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

public class HelloController {

    @GetMapping(path = "/hello")
    public ResponseEntity<String> hello() {

        return ResponseEntity.ok("hello there!");

The application has a simple controller with one mapping.

package com.zetcode.actuator;

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

import java.time.LocalDateTime;

public class MyEndpoint {

    public LocalDateTime now() {
        return LocalDateTime.now();

We create a custom actuator with @Endpoint. It returns the current datetime.

package com.zetcode;

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);

The Application sets up the Spring Boot application.

$ ./gradlew bootRun

We build the application and run it.

$ curl localhost:8080/actuator/health
$ curl localhost:8080/actuator/now

We check two endpoints.

In this tutorial we have worked with actuator endpoints.


My name is Jan Bodnar and I am a passionate programmer with many years of programming experience. I have been writing programming articles since 2007. So far, I have written over 1400 articles and 8 e-books. I have over eight years of experience in teaching programming.

List all Spring Boot tutorials.