Move endpoints.health.mapping to management.health.status.http-mapping
Closes gh-10052
This commit is contained in:
parent
f2a74946af
commit
3087514b79
|
@ -1,49 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2017 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.actuate.autoconfigure.endpoint.web;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.boot.actuate.endpoint.web.HealthWebEndpointExtension;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration properties for the {@link HealthWebEndpointExtension}.
|
|
||||||
*
|
|
||||||
* @author Christian Dupuis
|
|
||||||
* @author Andy Wilkinson
|
|
||||||
* @since 2.0.0
|
|
||||||
*/
|
|
||||||
@ConfigurationProperties(prefix = "endpoints.health")
|
|
||||||
public class HealthWebEndpointExtensionProperties {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mapping of health statuses to HttpStatus codes. By default, registered health
|
|
||||||
* statuses map to sensible defaults (i.e. UP maps to 200).
|
|
||||||
*/
|
|
||||||
private Map<String, Integer> mapping = new HashMap<>();
|
|
||||||
|
|
||||||
public Map<String, Integer> getMapping() {
|
|
||||||
return this.mapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMapping(Map<String, Integer> mapping) {
|
|
||||||
this.mapping = mapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -18,15 +18,16 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration;
|
import org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration;
|
||||||
import org.springframework.boot.actuate.autoconfigure.endpoint.ConditionalOnEnabledEndpoint;
|
import org.springframework.boot.actuate.autoconfigure.endpoint.ConditionalOnEnabledEndpoint;
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties;
|
||||||
import org.springframework.boot.actuate.endpoint.AuditEventsEndpoint;
|
import org.springframework.boot.actuate.endpoint.AuditEventsEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.StatusEndpoint;
|
import org.springframework.boot.actuate.endpoint.StatusEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.web.AuditEventsWebEndpointExtension;
|
import org.springframework.boot.actuate.endpoint.web.AuditEventsWebEndpointExtension;
|
||||||
import org.springframework.boot.actuate.endpoint.web.HealthStatusHttpMapper;
|
|
||||||
import org.springframework.boot.actuate.endpoint.web.HealthWebEndpointExtension;
|
import org.springframework.boot.actuate.endpoint.web.HealthWebEndpointExtension;
|
||||||
import org.springframework.boot.actuate.endpoint.web.HeapDumpWebEndpoint;
|
import org.springframework.boot.actuate.endpoint.web.HeapDumpWebEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.web.LogFileWebEndpoint;
|
import org.springframework.boot.actuate.endpoint.web.LogFileWebEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.web.StatusWebEndpointExtension;
|
import org.springframework.boot.actuate.endpoint.web.StatusWebEndpointExtension;
|
||||||
|
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
|
@ -48,7 +49,7 @@ import org.springframework.util.StringUtils;
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
@ManagementContextConfiguration
|
@ManagementContextConfiguration
|
||||||
@EnableConfigurationProperties(HealthWebEndpointExtensionProperties.class)
|
@EnableConfigurationProperties(HealthIndicatorProperties.class)
|
||||||
public class WebEndpointManagementContextConfiguration {
|
public class WebEndpointManagementContextConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -63,9 +64,8 @@ public class WebEndpointManagementContextConfiguration {
|
||||||
@ConditionalOnEnabledEndpoint
|
@ConditionalOnEnabledEndpoint
|
||||||
@ConditionalOnBean(value = HealthEndpoint.class, search = SearchStrategy.CURRENT)
|
@ConditionalOnBean(value = HealthEndpoint.class, search = SearchStrategy.CURRENT)
|
||||||
public HealthWebEndpointExtension healthWebEndpointExtension(HealthEndpoint delegate,
|
public HealthWebEndpointExtension healthWebEndpointExtension(HealthEndpoint delegate,
|
||||||
HealthWebEndpointExtensionProperties extensionProperties) {
|
HealthStatusHttpMapper healthStatusHttpMapper) {
|
||||||
return new HealthWebEndpointExtension(delegate,
|
return new HealthWebEndpointExtension(delegate, healthStatusHttpMapper);
|
||||||
createHealthStatusHttpMapper(extensionProperties));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -73,16 +73,17 @@ public class WebEndpointManagementContextConfiguration {
|
||||||
@ConditionalOnEnabledEndpoint
|
@ConditionalOnEnabledEndpoint
|
||||||
@ConditionalOnBean(value = StatusEndpoint.class, search = SearchStrategy.CURRENT)
|
@ConditionalOnBean(value = StatusEndpoint.class, search = SearchStrategy.CURRENT)
|
||||||
public StatusWebEndpointExtension statusWebEndpointExtension(StatusEndpoint delegate,
|
public StatusWebEndpointExtension statusWebEndpointExtension(StatusEndpoint delegate,
|
||||||
HealthWebEndpointExtensionProperties extensionProperties) {
|
HealthStatusHttpMapper healthStatusHttpMapper) {
|
||||||
return new StatusWebEndpointExtension(delegate,
|
return new StatusWebEndpointExtension(delegate, healthStatusHttpMapper);
|
||||||
createHealthStatusHttpMapper(extensionProperties));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HealthStatusHttpMapper createHealthStatusHttpMapper(
|
@Bean
|
||||||
HealthWebEndpointExtensionProperties extensionProperties) {
|
@ConditionalOnMissingBean
|
||||||
|
public HealthStatusHttpMapper createHealthStatusHttpMapper(
|
||||||
|
HealthIndicatorProperties healthIndicatorProperties) {
|
||||||
HealthStatusHttpMapper statusHttpMapper = new HealthStatusHttpMapper();
|
HealthStatusHttpMapper statusHttpMapper = new HealthStatusHttpMapper();
|
||||||
if (extensionProperties.getMapping() != null) {
|
if (healthIndicatorProperties.getHttpMapping() != null) {
|
||||||
statusHttpMapper.addStatusMapping(extensionProperties.getMapping());
|
statusHttpMapper.addStatusMapping(healthIndicatorProperties.getHttpMapping());
|
||||||
}
|
}
|
||||||
return statusHttpMapper;
|
return statusHttpMapper;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
|
|
||||||
package org.springframework.boot.actuate.autoconfigure.health;
|
package org.springframework.boot.actuate.autoconfigure.health;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
@ -34,6 +36,12 @@ public class HealthIndicatorProperties {
|
||||||
*/
|
*/
|
||||||
private List<String> order = null;
|
private List<String> order = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapping of health statuses to HttpStatus codes. By default, registered health
|
||||||
|
* statuses map to sensible defaults (i.e. UP maps to 200).
|
||||||
|
*/
|
||||||
|
private final Map<String, Integer> httpMapping = new HashMap<>();
|
||||||
|
|
||||||
public List<String> getOrder() {
|
public List<String> getOrder() {
|
||||||
return this.order;
|
return this.order;
|
||||||
}
|
}
|
||||||
|
@ -44,4 +52,8 @@ public class HealthIndicatorProperties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Integer> getHttpMapping() {
|
||||||
|
return this.httpMapping;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.springframework.boot.actuate.endpoint.web;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
|
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
|
||||||
import org.springframework.boot.endpoint.ReadOperation;
|
import org.springframework.boot.endpoint.ReadOperation;
|
||||||
import org.springframework.boot.endpoint.web.WebEndpointExtension;
|
import org.springframework.boot.endpoint.web.WebEndpointExtension;
|
||||||
import org.springframework.boot.endpoint.web.WebEndpointResponse;
|
import org.springframework.boot.endpoint.web.WebEndpointResponse;
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.springframework.boot.actuate.endpoint.web;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.endpoint.StatusEndpoint;
|
import org.springframework.boot.actuate.endpoint.StatusEndpoint;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
|
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
|
||||||
import org.springframework.boot.endpoint.ReadOperation;
|
import org.springframework.boot.endpoint.ReadOperation;
|
||||||
import org.springframework.boot.endpoint.web.WebEndpointExtension;
|
import org.springframework.boot.endpoint.web.WebEndpointExtension;
|
||||||
import org.springframework.boot.endpoint.web.WebEndpointResponse;
|
import org.springframework.boot.endpoint.web.WebEndpointResponse;
|
||||||
|
|
|
@ -14,13 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.boot.actuate.endpoint.web;
|
package org.springframework.boot.actuate.health;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.health.Status;
|
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,8 +107,6 @@ public class HealthStatusHttpMapper {
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String getUniformValue(String code) {
|
private String getUniformValue(String code) {
|
||||||
if (code == null) {
|
if (code == null) {
|
||||||
return null;
|
return null;
|
|
@ -25,12 +25,12 @@ import org.springframework.boot.actuate.endpoint.AuditEventsEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.StatusEndpoint;
|
import org.springframework.boot.actuate.endpoint.StatusEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.web.AuditEventsWebEndpointExtension;
|
import org.springframework.boot.actuate.endpoint.web.AuditEventsWebEndpointExtension;
|
||||||
import org.springframework.boot.actuate.endpoint.web.HealthStatusHttpMapper;
|
|
||||||
import org.springframework.boot.actuate.endpoint.web.HealthWebEndpointExtension;
|
import org.springframework.boot.actuate.endpoint.web.HealthWebEndpointExtension;
|
||||||
import org.springframework.boot.actuate.endpoint.web.HeapDumpWebEndpoint;
|
import org.springframework.boot.actuate.endpoint.web.HeapDumpWebEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.web.LogFileWebEndpoint;
|
import org.springframework.boot.actuate.endpoint.web.LogFileWebEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.web.StatusWebEndpointExtension;
|
import org.springframework.boot.actuate.endpoint.web.StatusWebEndpointExtension;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
|
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
@ -68,7 +68,7 @@ public class WebEndpointManagementContextConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
public void healthStatusMappingCanBeCustomized() {
|
public void healthStatusMappingCanBeCustomized() {
|
||||||
ApplicationContextRunner contextRunner = contextRunner()
|
ApplicationContextRunner contextRunner = contextRunner()
|
||||||
.withPropertyValues("endpoints.health.mapping.CUSTOM=500")
|
.withPropertyValues("management.health.status.http-mapping.CUSTOM=500")
|
||||||
.withUserConfiguration(HealthEndpointConfiguration.class);
|
.withUserConfiguration(HealthEndpointConfiguration.class);
|
||||||
contextRunner.run((context) -> {
|
contextRunner.run((context) -> {
|
||||||
HealthWebEndpointExtension extension = context
|
HealthWebEndpointExtension extension = context
|
||||||
|
@ -97,7 +97,7 @@ public class WebEndpointManagementContextConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
public void statusMappingCanBeCustomized() {
|
public void statusMappingCanBeCustomized() {
|
||||||
ApplicationContextRunner contextRunner = contextRunner()
|
ApplicationContextRunner contextRunner = contextRunner()
|
||||||
.withPropertyValues("endpoints.health.mapping.CUSTOM=500")
|
.withPropertyValues("management.health.status.http-mapping.CUSTOM=500")
|
||||||
.withUserConfiguration(StatusEndpointConfiguration.class);
|
.withUserConfiguration(StatusEndpointConfiguration.class);
|
||||||
contextRunner.run((context) -> {
|
contextRunner.run((context) -> {
|
||||||
StatusWebEndpointExtension extension = context
|
StatusWebEndpointExtension extension = context
|
||||||
|
|
|
@ -26,11 +26,11 @@ import org.springframework.boot.actuate.autoconfigure.ManagementContextAutoConfi
|
||||||
import org.springframework.boot.actuate.autoconfigure.endpoint.infrastructure.EndpointInfrastructureAutoConfiguration;
|
import org.springframework.boot.actuate.autoconfigure.endpoint.infrastructure.EndpointInfrastructureAutoConfiguration;
|
||||||
import org.springframework.boot.actuate.autoconfigure.endpoint.infrastructure.ServletEndpointAutoConfiguration;
|
import org.springframework.boot.actuate.autoconfigure.endpoint.infrastructure.ServletEndpointAutoConfiguration;
|
||||||
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
||||||
import org.springframework.boot.actuate.endpoint.web.HealthStatusHttpMapper;
|
|
||||||
import org.springframework.boot.actuate.endpoint.web.HealthWebEndpointExtension;
|
import org.springframework.boot.actuate.endpoint.web.HealthWebEndpointExtension;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicatorFactory;
|
import org.springframework.boot.actuate.health.HealthIndicatorFactory;
|
||||||
|
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
|
||||||
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
||||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
|
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.boot.actuate.endpoint.HealthEndpoint;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicatorFactory;
|
import org.springframework.boot.actuate.health.HealthIndicatorFactory;
|
||||||
|
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
|
||||||
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.boot.actuate.endpoint.StatusEndpoint;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicatorFactory;
|
import org.springframework.boot.actuate.health.HealthIndicatorFactory;
|
||||||
|
import org.springframework.boot.actuate.health.HealthStatusHttpMapper;
|
||||||
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
import org.springframework.boot.actuate.health.OrderedHealthAggregator;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
|
@ -1139,7 +1139,6 @@ content into your application; rather pick only the properties that you need.
|
||||||
endpoints.health.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
endpoints.health.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached.
|
||||||
endpoints.health.enabled=true # Enable the health endpoint.
|
endpoints.health.enabled=true # Enable the health endpoint.
|
||||||
endpoints.health.jmx.enabled=true # Expose the health endpoint as a JMX MBean.
|
endpoints.health.jmx.enabled=true # Expose the health endpoint as a JMX MBean.
|
||||||
endpoints.health.mapping= # Mapping of health statuses to HttpStatus codes. By default, registered health statuses map to sensible defaults (i.e. UP maps to 200).
|
|
||||||
endpoints.health.web.enabled=true # Expose the health endpoint as a Web endpoint.
|
endpoints.health.web.enabled=true # Expose the health endpoint as a Web endpoint.
|
||||||
|
|
||||||
# HEAP DUMP ENDPOINT ({sc-spring-boot-actuator}/endpoint/HeapDumpWebEndpoint.{sc-ext}[HeapDumpWebEndpoint])
|
# HEAP DUMP ENDPOINT ({sc-spring-boot-actuator}/endpoint/HeapDumpWebEndpoint.{sc-ext}[HeapDumpWebEndpoint])
|
||||||
|
@ -1258,6 +1257,7 @@ content into your application; rather pick only the properties that you need.
|
||||||
management.health.rabbit.enabled=true # Enable RabbitMQ health check.
|
management.health.rabbit.enabled=true # Enable RabbitMQ health check.
|
||||||
management.health.redis.enabled=true # Enable Redis health check.
|
management.health.redis.enabled=true # Enable Redis health check.
|
||||||
management.health.solr.enabled=true # Enable Solr health check.
|
management.health.solr.enabled=true # Enable Solr health check.
|
||||||
|
management.health.status.http-mapping= # Mapping of health statuses to HttpStatus codes. By default, registered health statuses map to sensible defaults (i.e. UP maps to 200).
|
||||||
management.health.status.order=DOWN, OUT_OF_SERVICE, UP, UNKNOWN # Comma-separated list of health statuses in order of severity.
|
management.health.status.order=DOWN, OUT_OF_SERVICE, UP, UNKNOWN # Comma-separated list of health statuses in order of severity.
|
||||||
|
|
||||||
# INFO CONTRIBUTORS ({sc-spring-boot-actuator}/autoconfigure/InfoContributorProperties.{sc-ext}[InfoContributorProperties])
|
# INFO CONTRIBUTORS ({sc-spring-boot-actuator}/autoconfigure/InfoContributorProperties.{sc-ext}[InfoContributorProperties])
|
||||||
|
|
|
@ -383,14 +383,16 @@ to your application properties:
|
||||||
|
|
||||||
The HTTP status code in the response reflects the overall health status (e.g. `UP`
|
The HTTP status code in the response reflects the overall health status (e.g. `UP`
|
||||||
maps to 200, `OUT_OF_SERVICE` or `DOWN` to 503). You might also want to register custom
|
maps to 200, `OUT_OF_SERVICE` or `DOWN` to 503). You might also want to register custom
|
||||||
status mappings with the `HealthMvcEndpoint` if you access the health endpoint over HTTP.
|
status mappings if you access the health endpoint over HTTP. For example, the following
|
||||||
For example, the following maps `FATAL` to `HttpStatus.SERVICE_UNAVAILABLE`:
|
maps `FATAL` to `HttpStatus.SERVICE_UNAVAILABLE`:
|
||||||
|
|
||||||
[source,properties,indent=0]
|
[source,properties,indent=0]
|
||||||
----
|
----
|
||||||
endpoints.health.mapping.FATAL=503
|
management.health.status.http-mapping.FATAL=503
|
||||||
----
|
----
|
||||||
|
|
||||||
|
TIP: If you need more control you can define your own `HealthStatusHttpMapper` bean.
|
||||||
|
|
||||||
The default status mappings for the built-in statuses are:
|
The default status mappings for the built-in statuses are:
|
||||||
|
|
||||||
[cols="1,3"]
|
[cols="1,3"]
|
||||||
|
|
Loading…
Reference in New Issue