mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Merge pull request #19290 from lyyprean
* gh-19290: Remove redundant hasText check as query always has text Closes gh-19290
This commit is contained in:
commit
c6d4ff6ed5
@ -107,12 +107,10 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement
|
||||
String product = getProduct();
|
||||
builder.up().withDetail("database", product);
|
||||
String validationQuery = getValidationQuery(product);
|
||||
if (StringUtils.hasText(validationQuery)) {
|
||||
// Avoid calling getObject as it breaks MySQL on Java 7
|
||||
List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper());
|
||||
Object result = DataAccessUtils.requiredSingleResult(results);
|
||||
builder.withDetail("hello", result);
|
||||
}
|
||||
// Avoid calling getObject as it breaks MySQL on Java 7
|
||||
List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper());
|
||||
Object result = DataAccessUtils.requiredSingleResult(results);
|
||||
builder.withDetail("hello", result);
|
||||
}
|
||||
|
||||
private String getProduct() {
|
||||
|
Loading…
Reference in New Issue
Block a user