Skip to content

Commit

Permalink
DataSource url property is ignored when there is no connection pool
Browse files Browse the repository at this point in the history
  • Loading branch information
nosan committed Jan 22, 2020
1 parent 0570a99 commit 1b41f53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ org.apache.commons.dbcp2.BasicDataSource dataSource(DataSourceProperties propert
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(DataSource.class)
@Conditional(GenericCondition.class)
@Conditional(ExplicitDataSourceTypeOrUrlCondition.class)
static class Generic {

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

}

static class GenericCondition extends AnyNestedCondition {
static class ExplicitDataSourceTypeOrUrlCondition extends AnyNestedCondition {

GenericCondition() {
ExplicitDataSourceTypeOrUrlCondition() {
super(ConfigurationPhase.PARSE_CONFIGURATION);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,8 @@ void explicitTypeNoSupportedDataSource() {
.run(this::containsOnlySimpleDriverDataSource);
}

/**
* This test makes sure that if no supported pool data source is present, a datasource
* is still created if "spring.datasource.url" is present.
*/
@Test
void explicitUrlSupportedDataSource() {
void createDataSourceExplicitUrlPresentAndNoPoolDataSourceAvailable() {
this.contextRunner
.withClassLoader(new FilteredClassLoader("org.apache.tomcat", "com.zaxxer.hikari",
"org.apache.commons.dbcp", "org.apache.commons.dbcp2"))
Expand Down

0 comments on commit 1b41f53

Please sign in to comment.