Commit 758b80a0 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.1.x' into 2.2.x

Closes gh-19299
parents fec61b5b c6d4ff6e
...@@ -107,16 +107,14 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement ...@@ -107,16 +107,14 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement
String product = getProduct(); String product = getProduct();
builder.up().withDetail("database", product); builder.up().withDetail("database", product);
String validationQuery = getValidationQuery(product); String validationQuery = getValidationQuery(product);
if (StringUtils.hasText(validationQuery)) { try {
try { // Avoid calling getObject as it breaks MySQL on Java 7
// Avoid calling getObject as it breaks MySQL on Java 7 List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper());
List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper()); Object result = DataAccessUtils.requiredSingleResult(results);
Object result = DataAccessUtils.requiredSingleResult(results); builder.withDetail("result", result);
builder.withDetail("result", result); }
} finally {
finally { builder.withDetail("validationQuery", validationQuery);
builder.withDetail("validationQuery", validationQuery);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment