Class AvailabilityStateHealthIndicator
java.lang.Object
org.springframework.boot.actuate.health.AbstractHealthIndicator
org.springframework.boot.actuate.availability.AvailabilityStateHealthIndicator
- All Implemented Interfaces:
HealthContributor
,HealthIndicator
- Direct Known Subclasses:
LivenessStateHealthIndicator
,ReadinessStateHealthIndicator
A
HealthIndicator
that checks a specific AvailabilityState
of the
application.- Since:
- 2.3.0
- Author:
- Phillip Webb, Brian Clozel
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Callback used to add status mappings. -
Constructor Summary
ConstructorDescriptionAvailabilityStateHealthIndicator
(ApplicationAvailability applicationAvailability, Class<S> stateType, Consumer<AvailabilityStateHealthIndicator.StatusMappings<S>> statusMappings) Create a newAvailabilityStateHealthIndicator
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doHealthCheck
(Health.Builder builder) Actual health check logic.protected AvailabilityState
getState
(ApplicationAvailability applicationAvailability) Return the current availability state.Methods inherited from class org.springframework.boot.actuate.health.AbstractHealthIndicator
health
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.boot.actuate.health.HealthIndicator
getHealth
-
Constructor Details
-
AvailabilityStateHealthIndicator
public AvailabilityStateHealthIndicator(ApplicationAvailability applicationAvailability, Class<S> stateType, Consumer<AvailabilityStateHealthIndicator.StatusMappings<S>> statusMappings) Create a newAvailabilityStateHealthIndicator
instance.- Type Parameters:
S
- the availability state type- Parameters:
applicationAvailability
- the application availabilitystateType
- the availability state typestatusMappings
- consumer used to setup the status mappings
-
-
Method Details
-
doHealthCheck
Description copied from class:AbstractHealthIndicator
Actual health check logic.- Specified by:
doHealthCheck
in classAbstractHealthIndicator
- Parameters:
builder
- theHealth.Builder
to report health status and details- Throws:
Exception
- anyException
that should create aStatus.DOWN
system status.
-
getState
Return the current availability state. Subclasses can override this method if a different retrieval mechanism is needed.- Parameters:
applicationAvailability
- the application availability- Returns:
- the current availability state
-