0
0
Spring Bootframework~5 mins

Actuator endpoints overview in Spring Boot

Choose your learning style9 modes available
Introduction

Actuator endpoints help you see how your Spring Boot app is doing. They give easy info about health, metrics, and more.

You want to check if your app is running well without digging into code.
You need to monitor app performance and resource usage.
You want to see detailed info about app configuration and environment.
You want to track app health in production automatically.
You want to expose info for external monitoring tools.
Syntax
Spring Boot
management.endpoints.web.exposure.include=health,info

# Example to enable all endpoints
management.endpoints.web.exposure.include=*
You configure which endpoints are available via application.properties or application.yml.
Common endpoints include /actuator/health, /actuator/info, /actuator/metrics.
Examples
This enables only the health and info endpoints to be accessible over HTTP.
Spring Boot
management.endpoints.web.exposure.include=health,info
This exposes all available actuator endpoints.
Spring Boot
management.endpoints.web.exposure.include=*
Use this command to check the health endpoint output from your running app.
Spring Boot
curl http://localhost:8080/actuator/health
Sample Program

This is a simple Spring Boot app with actuator endpoints enabled for health and info. When you visit the health endpoint, it shows if the app is up.

Spring Boot
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

# application.properties
management.endpoints.web.exposure.include=health,info

# After running, access http://localhost:8080/actuator/health

# Expected JSON response:
# {
#   "status": "UP"
# }
OutputSuccess
Important Notes

By default, only the health and info endpoints are enabled and exposed.

Some endpoints may require authentication in production for security.

You can customize actuator endpoints to add your own checks or info.

Summary

Actuator endpoints give you quick info about your Spring Boot app's health and status.

You enable and expose them via configuration properties.

Common endpoints include health, info, and metrics.