Spring Boot Actuator - Cannot Disable Default Management Health Checks

See original GitHub issue

When building a Spring Boot 1.1.9.RELEASE application with Spring Boot Actuator enabled, I cannot seem to disable the built in management.health checks. The health checks in question are:

management.health.db.enabled=false
management.health.diskspace.enabled=false
management.health.mongo.enabled=false
management.health.rabbit.enabled=false
management.health.redis.enabled=false
management.health.solr.enabled=false

After adding these lines to my application.properties file, I get errors on app start such as:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'managementServerProperties': Could not bind properties; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'health[diskspace][enabled]' of bean class [org.springframework.boot.actuate.autoconfigure.ManagementServerProperties]: Cannot access indexed value in property referenced in indexed property path 'health[diskspace][enabled]'; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'health[diskspace][enabled]' of bean class [org.springframework.boot.actuate.autoconfigure.ManagementServerProperties]: Bean property 'health[diskspace][enabled]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:300)
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:252)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1546)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
    at com.premierinc.chna.Application.main(Application.java:24)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'health[diskspace][enabled]' of bean class [org.springframework.boot.actuate.autoconfigure.ManagementServerProperties]: Cannot access indexed value in property referenced in indexed property path 'health[diskspace][enabled]'; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'health[diskspace][enabled]' of bean class [org.springframework.boot.actuate.autoconfigure.ManagementServerProperties]: Bean property 'health[diskspace][enabled]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:947)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:923)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:82)
    at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:728)
    at org.springframework.validation.DataBinder.doBind(DataBinder.java:624)
    at org.springframework.boot.bind.RelaxedDataBinder.doBind(RelaxedDataBinder.java:93)
    at org.springframework.validation.DataBinder.bind(DataBinder.java:609)
    at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:275)
    at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:225)
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:297)
    ... 18 more
Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'health[diskspace][enabled]' of bean class [org.springframework.boot.actuate.autoconfigure.ManagementServerProperties]: Bean property 'health[diskspace][enabled]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:726)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:944)
    ... 27 more

Basically, I don’t want Spring reporting that services are down that I don’t even have in my project, but when I try to disable them, the app breaks. I have custom health checks that I want to register, but that’s all I want.

Am I missing something obvious?

Thanks!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthewEdgecommented, Dec 12, 2014

@snicoll Perfect, that solved my issue. For future users who may run into the same issue, I’d recommend updating the keys displayed on http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#common-application-properties

The # HEALTH INDICATORS section lists the management namespace for these keys

Thanks everybody!

0reactions
wilkinsonacommented, Apr 3, 2018

@jofisiva Please ask questions on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can i disable spring boot actuator elastic search health ...
Just disable the default health check, create a custom health check class and use that. Something like the custom HealthCheck, ...
Read more >
Production-ready Features - Spring
Checks that a Redis server is up. You can disable them all by setting the management.health.defaults.enabled property.
Read more >
How to Enable All Endpoints in Spring Boot Actuator - Baeldung
Starting with Spring Boot 2, we have to enable and expose our endpoints. By default, all endpoints but /shutdown are enabled and only...
Read more >
Help, my Spring Boot info actuator endpoint is enabled, but I ...
Be aware that all actuators except for /health are disabled by default for security reasons. They might expose sensitive information. You can ...
Read more >
Health Checks - Apache Camel
HealthCheckRepository: a simple interface to define health check providers. By default there is one that grabs all the checks available in the registry...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found