How to implement guide with spring boot actuator health check not reporting custom health indicators properly
I'm currently using Spring Boot 2.6.4 and have implemented a custom health indicator for our application that monitors an external service. However, when I access the `/actuator/health` endpoint, the custom indicator does not seem to be included in the response. I followed the standard approach by implementing the `HealthIndicator` interface and annotating my class with `@Component`. Here's the code for my custom health indicator: ```java import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.stereotype.Component; @Component public class MyCustomHealthIndicator implements HealthIndicator { @Override public Health health() { boolean isHealthy = checkExternalService(); if (isHealthy) { return Health.up().withDetail("Service Status", "UP").build(); } return Health.down().withDetail("Service Status", "DOWN").build(); } private boolean checkExternalService() { // Logic to check whether the external service is reachable return true; // Simulating that the service is always up } } ``` I have also verified that the `management.endpoints.web.exposure.include` property in my `application.properties` file is set correctly: ``` management.endpoints.web.exposure.include=* ``` Yet, when I make a GET request to `/actuator/health`, I only see the default health indicators listed: ```json { "status": "UP", "components": { "diskSpace": { "status": "UP", "details": { "total": 100000, "free": 50000, "threshold": 10000 } }, "database": { "status": "UP" } } } ``` I've tried placing debug statements within the `health()` method to confirm it's being invoked, but it seems like it never gets called. Is there something I may have missed in the configuration or the way Spring Boot scans for components? Any help would be appreciated!