It's all some autoconfigured beans at the end When it comes to spring-boot. All you need to do is to autowire the specific healthCheckIndicatorBean of your choice and get things done with that bean.
for example,
@Autowired
DiskSpaceHealthIndicator diskSpaceHealthIndicator;
@Scheduled(fixedDelay = 10000)
void printDiskHealthCheckEveryTenSeconds() {
logger.info("Current Disk health {}", diskSpaceHealthIndicator.health().getStatus());
logger.info("Current Disk details {}", diskSpaceHealthIndicator.health().getDetails());
}
And, The following is the list of AutoConfigured health Check Indicator beans that you could make use of.
CassandraHealthIndicator - Checks that a Cassandra database is up.
DiskSpaceHealthIndicator - Checks for low disk space.
DataSourceHealthIndicator - Checks that a connection to DataSource can be obtained.
ElasticsearchHealthIndicator - Checks that an Elasticsearch cluster is up.
InfluxDbHealthIndicator - Checks that an InfluxDB server is up.
JmsHealthIndicator - Checks that a JMS broker is up.
MailHealthIndicator - Checks that a mail server is up.
MongoHealthIndicator - Checks that a Mongo database is up.
Neo4jHealthIndicator - Checks that a Neo4j server is up.
RabbitHealthIndicator - Checks that a Rabbit server is up.
RedisHealthIndicator - Checks that a Redis server is up.
SolrHealthIndicator - Checks that a Solr server is up.