In the springboot project that I work on there is a transitive maven dependency on spring-data-mongodb. Therefore the MongoHealthIndicator seems to be activated automatically although the project does not actually use mongodb. Is it possible to deactivate specifically this HealthIndicator without deactivating the actuator health endpoint? A workaround that I found is excluding the dependency. But I was wondering if it is possible to do this specific deactivation of the MongoHealthIndicator.
If you want to disable health indicator completely, then you have to set management. health. binders. enabled to false .
You can enable or disable an actuator endpoint by setting the property management. endpoint. <id>. enabled to true or false (where id is the identifier for the endpoint).
The shutdown endpoint of the spring boot actuator is disabled by default. You can enable the shutdown endpoint with the following command. The POST method can be used to run to the shutdown command.
To enable Spring Boot actuator endpoints to your Spring Boot application, we need to add the Spring Boot Starter actuator dependency in our build configuration file. Maven users can add the below dependency in your pom. xml file. Gradle users can add the below dependency in your build.
From:
http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# HEALTH INDICATORS (previously health.*)
...
management.health.mongo.enabled=true
...
You should be able to set that to false to disable the health indicator. From org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration.java
@Configuration
@ConditionalOnBean(MongoTemplate.class)
@ConditionalOnProperty(prefix = "management.health.mongo", name = "enabled", matchIfMissing = true)
public static class MongoHealthIndicatorConfiguration {
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With