|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|