Improve liveness/readiness health config

Prior to this commit, the application availability infrastructure
would mix the `AvailabilityState`, the `HealthIndicator` and the
`HealthGroup` concepts and would not align with the rest.

This commit auto-configures the livenessState and readinessState
health indicators with the relevant configuration properties.
Unlike other indicators, they are not enabled by default but might
be in future versions.

This also moves the `management.health.probes.enabled` property
to `management.endpoint.health.probes.enabled` since "probes" here
is not a health indicator but rather a configuration flag for the
health endpoint.

Finally, the probes auto-configuration is refined to automatically
add liveness and readiness indicators for the probes group if
they're not already present.

Closes gh-22107
This commit is contained in:
Brian Clozel
2020-07-21 16:02:35 +02:00
parent cb73558856
commit fe807d6c0b
7 changed files with 193 additions and 21 deletions

View File

@@ -712,6 +712,20 @@ The following `HealthIndicators` are auto-configured by Spring Boot when appropr
TIP: You can disable them all by setting the configprop:management.health.defaults.enabled[] property.
Additional `HealthIndicators` are available but not enabled by default;
developers can use their configuration property to activate them:
[cols="4,6"]
|===
| Name | Description
| {spring-boot-actuator-module-code}/availability/LivenessStateHealthIndicator.java[`LivenessStateHealthIndicator`]
| Checks the liveness state of the application.
| {spring-boot-actuator-module-code}/availability/ReadinessStateHealthIndicator.java[`ReadinessStateHealthIndicator`]
| Checks the readiness state of the application.
|===
==== Writing Custom HealthIndicators