How do you customize Actuator endpoints?

Actuator endpoints can be customized through configuration properties to control which endpoints are exposed and how much detail they reveal, and extended with entirely custom endpoints for application-specific management operations.

Key Points: • management.endpoints.web.exposure.include/exclude controls which built-in endpoints are reachable over HTTP. • management.endpoint.<id>.enabled toggles individual endpoints on or off. • management.endpoints.web.base-path changes the default /actuator path prefix. • Custom endpoints are created with @Endpoint plus @ReadOperation, @WriteOperation, or @DeleteOperation methods. • Sensitive endpoints should be restricted to internal networks or secured with Spring Security roles.

Example: A team adds a custom /actuator/cache-status endpoint using @Endpoint(id = "cache-status") and a @ReadOperation method that reports current cache size, giving operators a quick way to inspect cache health without a database query.

Code Example:

@Component
@Endpoint(id = "cache-status")
public class CacheStatusEndpoint {

    @ReadOperation
    public Map<String, Object> cacheStatus() {
        return Map.of("size", cache.estimatedSize());
    }
}

Interview Tip: A concise interview answer is:

"I customize which Actuator endpoints are exposed through the management.endpoints.web.exposure properties, and for application-specific needs I build a custom endpoint with @Endpoint and @ReadOperation. I also make sure sensitive endpoints like env or heapdump are locked down rather than publicly exposed."