Class AbstractHealthIndicator
- java.lang.Object
- org.springframework.boot.actuate.health.AbstractHealthIndicator
- All Implemented Interfaces:
HealthIndicator
- Direct Known Subclasses:
ApplicationHealthIndicator
,CassandraHealthIndicator
,CouchbaseHealthIndicator
,DataSourceHealthIndicator
,DiskSpaceHealthIndicator
,ElasticsearchHealthIndicator
,ElasticsearchJestHealthIndicator
,ElasticsearchRestHealthIndicator
,InfluxDbHealthIndicator
,JmsHealthIndicator
,LdapHealthIndicator
,MailHealthIndicator
,MongoHealthIndicator
,Neo4jHealthIndicator
,RabbitHealthIndicator
,RedisHealthIndicator
,SolrHealthIndicator
public abstract class AbstractHealthIndicator extends Object implements HealthIndicator
BaseHealthIndicator
implementations that encapsulates creation ofHealth
instance and error handling.This implementation is only suitable if an
Exception
raised fromdoHealthCheck(org.springframework.boot.actuate.health.Health.Builder)
should create aStatus.DOWN
health status.- Since:
- 1.1.0
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractHealthIndicator()
Create a newAbstractHealthIndicator
instance with a defaulthealthCheckFailedMessage
.protected
AbstractHealthIndicator(String healthCheckFailedMessage)
Create a newAbstractHealthIndicator
instance with a specific message to log when the health check fails.protected
AbstractHealthIndicator(Function<Exception,String> healthCheckFailedMessage)
Create a newAbstractHealthIndicator
instance with a specific message to log when the health check fails.
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
doHealthCheck(Health.Builder builder)
Actual health check logic.Health
health()
Return an indication of health.
Constructor Detail
AbstractHealthIndicator
protected AbstractHealthIndicator()
Create a newAbstractHealthIndicator
instance with a defaulthealthCheckFailedMessage
.
AbstractHealthIndicator
protected AbstractHealthIndicator(String healthCheckFailedMessage)
Create a newAbstractHealthIndicator
instance with a specific message to log when the health check fails.- Parameters:
healthCheckFailedMessage
- the message to log on health check failure- Since:
- 2.0.0
AbstractHealthIndicator
protected AbstractHealthIndicator(Function<Exception,String> healthCheckFailedMessage)
Create a newAbstractHealthIndicator
instance with a specific message to log when the health check fails.- Parameters:
healthCheckFailedMessage
- the message to log on health check failure- Since:
- 2.0.0
Method Detail
health
public final Health health()
Description copied from interface:HealthIndicator
Return an indication of health.- Specified by:
health
in interfaceHealthIndicator
- Returns:
- the health for
doHealthCheck
protected abstract void doHealthCheck(Health.Builder builder) throws Exception
Actual health check logic.- Parameters:
builder
- theHealth.Builder
to report health status and details- Throws:
Exception
- anyException
that should create aStatus.DOWN
system status.