public abstract class AbstractHealthIndicator extends Object implements HealthIndicator
HealthIndicator
implementations that encapsulates creation of
Health
instance and error handling.
This implementation is only suitable if an Exception
raised from
doHealthCheck(org.springframework.boot.actuate.health.Health.Builder)
should
create a Status.DOWN
health status.
Modifier | Constructor and Description |
---|---|
protected |
AbstractHealthIndicator()
Create a new
AbstractHealthIndicator instance with a default
healthCheckFailedMessage . |
protected |
AbstractHealthIndicator(Function<Exception,String> healthCheckFailedMessage)
Create a new
AbstractHealthIndicator instance with a specific message to
log when the health check fails. |
protected |
AbstractHealthIndicator(String healthCheckFailedMessage)
Create a new
AbstractHealthIndicator instance with a specific message to
log when the health check fails. |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doHealthCheck(Health.Builder builder)
Actual health check logic.
|
Health |
health()
Return an indication of health.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHealth
protected AbstractHealthIndicator()
AbstractHealthIndicator
instance with a default
healthCheckFailedMessage
.protected AbstractHealthIndicator(String healthCheckFailedMessage)
AbstractHealthIndicator
instance with a specific message to
log when the health check fails.healthCheckFailedMessage
- the message to log on health check failureprotected AbstractHealthIndicator(Function<Exception,String> healthCheckFailedMessage)
AbstractHealthIndicator
instance with a specific message to
log when the health check fails.healthCheckFailedMessage
- the message to log on health check failurepublic final Health health()
HealthIndicator
health
in interface HealthIndicator
protected abstract void doHealthCheck(Health.Builder builder) throws Exception
builder
- the Health.Builder
to report health status and detailsException
- any Exception
that should create a Status.DOWN
system status.