Spring Boot Actuator

pring Boot Actuator provides production-ready features to help monitor and manage application.

1. Common Actuator Endpoints

  • /actuator/health – app health status
  • /actuator/info – shows app info (can include custom data)
  • /actuator/metrics – shows performance metrics
  • /actuator/beans – lists all configured beans
  • /actuator/env – shows environment properties
  • /actuator/mappings – lists all request mappings
  • /actuator/shutdown – gracefully shuts down the app
  • /actuator/threaddump – shows thread dump

2. Enable by adding the dependency

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    <version>3.5.6</version>
</dependency>

3. Spring Actuator Endpoints Security

By default, only /health and /info are publicly accessible; all other Actuator endpoints require Spring Security configuration. Configure exposed endpoints in application.properties

# - enable all endpoints
management.endpoints.web.exposure.include=*

# - enable all endpoints except beans
management.endpoints.web.exposure.exclude=beans


# - enable only beans and health
management.endpoints.web.exposure.include=beans,health

4. Customizing Actuator End Points Base Path

By default base-path of actuator endpoints is /actuator.We can change the default /actuator base path using:

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

5. Spring Actuator Custom Endpoints

can be access through actuator/myendpoint

@Endpoint(id = "myendpoint")
@Component
public class CustomActuator {

    @Bean
    @ReadOperation
    public String customActuatorMethod() {
        return "This is Custom Actuator Endpoint";
    }
}

↑ Back to top