Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to deactivate MongoHealthIndicator in the Springboot spring actuator health endpoint?

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.

like image 592
alexandra.s Avatar asked Jun 10 '15 17:06

alexandra.s


People also ask

How do I turn off my spring boot health indicator?

If you want to disable health indicator completely, then you have to set management. health. binders. enabled to false .

How do I disable spring security for actuator endpoints?

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).

Which endpoint is disabled by default in spring boot actuator?

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.

How do you turn on actuator endpoints in spring boot?

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.


1 Answers

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 {
like image 195
randominstanceOfLivingThing Avatar answered Sep 27 '22 16:09

randominstanceOfLivingThing