Skip to content

Commit 1b41f53

Browse files
committed
DataSource url property is ignored when there is no connection pool
1 parent 0570a99 commit 1b41f53

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ org.apache.commons.dbcp2.BasicDataSource dataSource(DataSourceProperties propert
118118
*/
119119
@Configuration(proxyBeanMethods = false)
120120
@ConditionalOnMissingBean(DataSource.class)
121-
@Conditional(GenericCondition.class)
121+
@Conditional(ExplicitDataSourceTypeOrUrlCondition.class)
122122
static class Generic {
123123

124124
@Bean
@@ -136,9 +136,9 @@ private static Class<? extends DataSource> determineType(DataSourceProperties pr
136136

137137
}
138138

139-
static class GenericCondition extends AnyNestedCondition {
139+
static class ExplicitDataSourceTypeOrUrlCondition extends AnyNestedCondition {
140140

141-
GenericCondition() {
141+
ExplicitDataSourceTypeOrUrlCondition() {
142142
super(ConfigurationPhase.PARSE_CONFIGURATION);
143143
}
144144

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,8 @@ void explicitTypeNoSupportedDataSource() {
158158
.run(this::containsOnlySimpleDriverDataSource);
159159
}
160160

161-
/**
162-
* This test makes sure that if no supported pool data source is present, a datasource
163-
* is still created if "spring.datasource.url" is present.
164-
*/
165161
@Test
166-
void explicitUrlSupportedDataSource() {
162+
void createDataSourceExplicitUrlPresentAndNoPoolDataSourceAvailable() {
167163
this.contextRunner
168164
.withClassLoader(new FilteredClassLoader("org.apache.tomcat", "com.zaxxer.hikari",
169165
"org.apache.commons.dbcp", "org.apache.commons.dbcp2"))

0 commit comments

Comments
 (0)