How can we secure the actuator endpoints?

Spring Boot Actuator endpoints expose application health, metrics, environment details, thread information, and other operational data. Since some endpoints may reveal sensitive system information, they must be properly secured to prevent unauthorized access.

Key Points

Example

In a production banking application, operations teams may need access to health and metrics endpoints, while regular users should not be able to view any actuator information.

application.properties

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

Spring Security Configuration

@Bean
public SecurityFilterChain securityFilterChain(
        HttpSecurity http) throws Exception {
    http.authorizeHttpRequests(auth -> auth
        .requestMatchers("/actuator/**")
        .hasRole("ACTUATOR_ADMIN")
        .anyRequest()
        .authenticated());

    return http.build();
}

In this example, only users with the ACTUATOR_ADMIN role can access actuator endpoints.

Additional Security Measures

Example

management.server.port=9090

This separates actuator traffic from normal application traffic.

Real-World Example

In a microservices environment

This provides monitoring capabilities while maintaining security.

Interview Tip

A concise interview answer is: We can secure Actuator endpoints by limiting endpoint exposure, enabling Spring Security authentication and authorization, assigning a dedicated role such as ACTUATOR_ADMIN, using HTTPS, and exposing only the required monitoring endpoints. This ensures operational data remains accessible only to authorized users.

Last updated: 1 November 2026

Previous question: What are Spring Boot Actuator endpoints?

Next question: How can we handle multiple beans of the same type?

More Spring Boot - Level II interview questions

All Spring Boot - Level II questions