Skip to content

Spring Boot Actuator - Cannot Disable Default Management Health Checks #2128

Closed
@MatthewEdge

Description

@MatthewEdge

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!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions