diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java index a80546a902f..48a3f3b7528 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java @@ -95,7 +95,7 @@ public class HealthIndicatorAutoConfiguration { @Configuration @ConditionalOnBean(DataSource.class) - @ConditionalOnProperty(prefix = "health.db", name = "enabled", matchIfMissing = true) + @ConditionalOnProperty(prefix = "management.health.db", name = "enabled", matchIfMissing = true) public static class DataSourcesHealthIndicatorConfiguration { @Autowired @@ -142,7 +142,7 @@ public class HealthIndicatorAutoConfiguration { @Configuration @ConditionalOnBean(MongoTemplate.class) - @ConditionalOnProperty(prefix = "health.mongo", name = "enabled", matchIfMissing = true) + @ConditionalOnProperty(prefix = "management.health.mongo", name = "enabled", matchIfMissing = true) public static class MongoHealthIndicatorConfiguration { @Autowired @@ -171,7 +171,7 @@ public class HealthIndicatorAutoConfiguration { @Configuration @ConditionalOnBean(RedisConnectionFactory.class) - @ConditionalOnProperty(prefix = "health.redis", name = "enabled", matchIfMissing = true) + @ConditionalOnProperty(prefix = "management.health.redis", name = "enabled", matchIfMissing = true) public static class RedisHealthIndicatorConfiguration { @Autowired @@ -201,7 +201,7 @@ public class HealthIndicatorAutoConfiguration { @Configuration @ConditionalOnBean(RabbitTemplate.class) - @ConditionalOnProperty(prefix = "health.rabbit", name = "enabled", matchIfMissing = true) + @ConditionalOnProperty(prefix = "management.health.rabbit", name = "enabled", matchIfMissing = true) public static class RabbitHealthIndicatorConfiguration { @Autowired @@ -231,7 +231,7 @@ public class HealthIndicatorAutoConfiguration { @Configuration @ConditionalOnBean(SolrServer.class) - @ConditionalOnProperty(prefix = "health.solr", name = "enabled", matchIfMissing = true) + @ConditionalOnProperty(prefix = "management.health.solr", name = "enabled", matchIfMissing = true) public static class SolrHealthIndicatorConfiguration { @Autowired @@ -259,7 +259,7 @@ public class HealthIndicatorAutoConfiguration { } @Configuration - @ConditionalOnProperty(prefix = "health.diskspace", name = "enabled", matchIfMissing = true) + @ConditionalOnProperty(prefix = "management.health.diskspace", name = "enabled", matchIfMissing = true) public static class DiskSpaceHealthIndicatorConfiguration { @Bean diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationProperties.java index 6eff89cad22..31e73510eb8 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationProperties.java @@ -26,7 +26,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * @author Christian Dupuis * @since 1.2.0 */ -@ConfigurationProperties("health.status") +@ConfigurationProperties("management.health.status") public class HealthIndicatorAutoConfigurationProperties { private List order = null; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorProperties.java index 2e057effe33..514c7bbd701 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorProperties.java @@ -27,7 +27,7 @@ import org.springframework.util.Assert; * @author Andy Wilkinson * @since 1.2.0 */ -@ConfigurationProperties("health.diskspace") +@ConfigurationProperties("management.health.diskspace") public class DiskSpaceHealthIndicatorProperties { private static final int MEGABYTES = 1024 * 1024; diff --git a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json index c3a2db54ffb..4434012aaf1 100644 --- a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,4 +1,40 @@ {"properties": [ + { + "name": "management.health.db.enabled", + "dataType": "java.lang.Boolean", + "description": "Enable database health check.", + "defaultValue": true + }, + { + "name": "management.health.diskspace.enabled", + "dataType": "java.lang.Boolean", + "description": "Enable disk space health check.", + "defaultValue": true + }, + { + "name": "management.health.mongo.enabled", + "dataType": "java.lang.Boolean", + "description": "Enable MongoDB health check.", + "defaultValue": true + }, + { + "name": "management.health.rabbit.enabled", + "dataType": "java.lang.Boolean", + "description": "Enable RabbitMQ health check.", + "defaultValue": true + }, + { + "name": "management.health.redis.enabled", + "dataType": "java.lang.Boolean", + "description": "Enable Redis health check.", + "defaultValue": true + }, + { + "name": "management.health.solr.enabled", + "dataType": "java.lang.Boolean", + "description": "Enable Solr health check.", + "defaultValue": true + }, { "name": "spring.git.properties", "dataType": "java.lang.String", diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index 35b5deb1ee7..2a99a7262f6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -78,7 +78,7 @@ public class HealthIndicatorAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); this.context.register(HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, - "health.diskspace.enabled:false"); + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -93,7 +93,7 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(RedisAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, - "health.diskspace.enabled:false"); + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -107,8 +107,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); this.context.register(RedisAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, "health.redis.enabled:false", - "health.diskspace.enabled:false"); + EnvironmentTestUtils.addEnvironment(this.context, "management.health.redis.enabled:false", + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -123,7 +123,7 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, - "health.diskspace.enabled:false"); + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -137,8 +137,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); this.context.register(MongoAutoConfiguration.class, MongoDataAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, "health.mongo.enabled:false", - "health.diskspace.enabled:false"); + EnvironmentTestUtils.addEnvironment(this.context, "management.health.mongo.enabled:false", + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -165,7 +165,7 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(EmbeddedDataSourceConfiguration.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, - "health.diskspace.enabled:false"); + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -183,7 +183,7 @@ public class HealthIndicatorAutoConfigurationTests { HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.validation-query:SELECT from FOOBAR", - "health.diskspace.enabled:false"); + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -199,8 +199,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); this.context.register(EmbeddedDataSourceConfiguration.class, HealthIndicatorAutoConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, "health.db.enabled:false", - "health.diskspace.enabled:false"); + EnvironmentTestUtils.addEnvironment(this.context, "management.health.db.enabled:false", + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -215,7 +215,7 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(RabbitAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, - "health.diskspace.enabled:false"); + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -229,8 +229,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); this.context.register(RabbitAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, "health.rabbit.enabled:false", - "health.diskspace.enabled:false"); + EnvironmentTestUtils.addEnvironment(this.context, "management.health.rabbit.enabled:false", + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -245,7 +245,7 @@ public class HealthIndicatorAutoConfigurationTests { this.context.register(SolrAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, - "health.diskspace.enabled:false"); + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); @@ -259,8 +259,8 @@ public class HealthIndicatorAutoConfigurationTests { this.context = new AnnotationConfigApplicationContext(); this.context.register(SolrAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); - EnvironmentTestUtils.addEnvironment(this.context, "health.solr.enabled:false", - "health.diskspace.enabled:false"); + EnvironmentTestUtils.addEnvironment(this.context, "management.health.solr.enabled:false", + "management.health.diskspace.enabled:false"); this.context.refresh(); Map beans = this.context .getBeansOfType(HealthIndicator.class); diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index a2315d96f2b..f3c2d87f532 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -398,8 +398,15 @@ content into your application; rather pick only the properties that you need. endpoints.trace.enabled=true # HEALTH INDICATORS - health.diskspace.path=. - health.diskspace.threshold=10485760 + management.health.db.enabled=true + management.health.diskspace.enabled=true + management.health.mongo.enabled=true + management.health.rabbit.enabled=true + management.health.redis.enabled=true + management.health.solr.enabled=true + management.health.diskspace.path=. + management.health.diskspace.threshold=10485760 + management.health.status.order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP # MVC ONLY ENDPOINTS endpoints.jolokia.path=jolokia diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 61eaeda13fe..fd03432e7ee 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -174,11 +174,11 @@ Besides implementing custom a `HealthIndicator` type and using out-of-box {sc-sp types, it is also possible to introduce custom `Status` types for different or more complex system states. In that case a custom implementation of the {sc-spring-boot-actuator}/health/HealthAggregator.{sc-ext}[`HealthAggregator`] interface needs to be provided or the default implementation has to be configured using the -`health.status.order` configuration property. +`management.health.status.order` configuration property. Assuming a new `Status` with code `FATAL` is being used in one of your `HealthIndicator` implementations. To configure the severity or order add the following to your application properties: -`health.status.order: FATAL, DOWN, UNKNOWN, UP`. +`management.health.status.order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP`.