diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index bc8c23f4c9..45e68f59d6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -19,13 +19,7 @@ package org.springframework.boot.autoconfigure.jdbc; import javax.sql.DataSource; import javax.sql.XADataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.springframework.beans.factory.BeanFactoryUtils; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; import org.springframework.boot.autoconfigure.condition.ConditionMessage; @@ -63,9 +57,6 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; @Import({ Registrar.class, DataSourcePoolMetadataProvidersConfiguration.class }) public class DataSourceAutoConfiguration { - private static final Log logger = LogFactory - .getLog(DataSourceAutoConfiguration.class); - @Bean @ConditionalOnMissingBean public DataSourceInitializer dataSourceInitializer(DataSourceProperties properties, @@ -73,24 +64,6 @@ public class DataSourceAutoConfiguration { return new DataSourceInitializer(properties, applicationContext); } - /** - * Determines if the {@code dataSource} being used by Spring was created from - * {@link EmbeddedDataSourceConfiguration}. - * @param beanFactory the bean factory - * @return true if the data source was auto-configured. - */ - public static boolean containsAutoConfiguredDataSource( - ConfigurableListableBeanFactory beanFactory) { - try { - BeanDefinition beanDefinition = beanFactory.getBeanDefinition("dataSource"); - return EmbeddedDataSourceConfiguration.class.getName() - .equals(beanDefinition.getFactoryBeanName()); - } - catch (NoSuchBeanDefinitionException ex) { - return false; - } - } - @Configuration @Conditional(EmbeddedDatabaseCondition.class) @ConditionalOnMissingBean({ DataSource.class, XADataSource.class }) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java index 54e064851b..f62b23806c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java @@ -45,7 +45,6 @@ import org.springframework.util.StringUtils; * @author EddĂș MelĂ©ndez * @author Stephane Nicoll * @author Kazuki Shimizu - * @since 1.1.0 * @see DataSourceAutoConfiguration */ class DataSourceInitializer implements ApplicationListener {