Reuse data source validation query in health endpoint

This commit improves DataSourceMetadata to expose the validation
query. This can be used by DataSourceHealthIndicator as the query
to use instead of "guessing" which query could be applied according
to the database type.

Fixes gh-1282
This commit is contained in:
Stephane Nicoll
2014-08-29 14:58:01 +02:00
parent 2694941b93
commit 53c4859a6a
12 changed files with 150 additions and 17 deletions

View File

@@ -164,8 +164,8 @@ To provide custom health information you can register a Spring bean that impleme
Spring Boot provides a
{sc-spring-boot-actuator}/health/DataSourceHealthIndicator.{sc-ext}[`DataSourceHealthIndicator`]
implementation that attempts a simple database test as well as implementations for
Redis, MongoDB and RabbitMQ.
implementation that attempts a simple database test (reusing the validation query set on the data
source, if any) as well as implementations for Redis, MongoDB and RabbitMQ.
Spring Boot adds the `HealthIndicator` instances automatically if beans of type `DataSource`,
`MongoTemplate`, `RedisConnectionFactory`, `RabbitTemplate` are present in the `ApplicationContext`.