mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Move health.* properties to management.health.*
Fixes gh-1841
This commit is contained in:
parent
27cbf45dbe
commit
00961611b2
@ -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
|
||||
|
@ -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<String> order = null;
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> 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<String, HealthIndicator> beans = this.context
|
||||
.getBeansOfType(HealthIndicator.class);
|
||||
|
@ -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
|
||||
|
@ -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`.
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user