diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index ded26380bb..3ecdab3d24 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -102,23 +102,12 @@ public class DataSourceAutoConfiguration { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage.forCondition("PooledDataSource"); - if (getDataSourceClassLoader(context) != null) { + if (DataSourceBuilder.findType(context.getClassLoader()) != null) { return ConditionOutcome.match(message.foundExactly("supported DataSource")); } return ConditionOutcome.noMatch(message.didNotFind("supported DataSource").atAll()); } - /** - * Returns the class loader for the {@link DataSource} class. Used to ensure that - * the driver class can actually be loaded by the data source. - * @param context the condition context - * @return the class loader - */ - private ClassLoader getDataSourceClassLoader(ConditionContext context) { - Class dataSourceClass = DataSourceBuilder.findType(context.getClassLoader()); - return (dataSourceClass != null) ? dataSourceClass.getClassLoader() : null; - } - } /**