diff --git a/spring-boot-autoconfigure/pom.xml b/spring-boot-autoconfigure/pom.xml
index 5381898e61..7e88dd26f7 100755
--- a/spring-boot-autoconfigure/pom.xml
+++ b/spring-boot-autoconfigure/pom.xml
@@ -145,11 +145,6 @@
jersey-media-json-jackson
true
-
- commons-dbcp
- commons-dbcp
- true
-
org.apache.activemq
activemq-broker
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 f3d1217b59..6b7ec2bfff 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
@@ -101,8 +101,7 @@ public class DataSourceAutoConfiguration {
@Conditional(PooledDataSourceCondition.class)
@ConditionalOnMissingBean({ DataSource.class, XADataSource.class })
@Import({ DataSourceConfiguration.Tomcat.class, DataSourceConfiguration.Hikari.class,
- DataSourceConfiguration.Dbcp.class, DataSourceConfiguration.Dbcp2.class,
- DataSourceConfiguration.Generic.class })
+ DataSourceConfiguration.Dbcp2.class, DataSourceConfiguration.Generic.class })
protected static class PooledDataSourceConfiguration {
}
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java
index 31a2d1d855..3c65908125 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java
@@ -44,7 +44,6 @@ public class DataSourceBuilder {
private static final String[] DATA_SOURCE_TYPE_NAMES = new String[] {
"org.apache.tomcat.jdbc.pool.DataSource",
"com.zaxxer.hikari.HikariDataSource",
- "org.apache.commons.dbcp.BasicDataSource", //deprecated
"org.apache.commons.dbcp2.BasicDataSource" };
private Class extends DataSource> type;
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java
index 72e51ed733..f516e384db 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java
@@ -75,28 +75,6 @@ abstract class DataSourceConfiguration {
}
}
- @ConditionalOnClass(org.apache.commons.dbcp.BasicDataSource.class)
- @ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.commons.dbcp.BasicDataSource", matchIfMissing = true)
- @Deprecated
- static class Dbcp extends DataSourceConfiguration {
-
- @Bean
- @ConfigurationProperties("spring.datasource.dbcp")
- public org.apache.commons.dbcp.BasicDataSource dataSource(
- DataSourceProperties properties) {
- org.apache.commons.dbcp.BasicDataSource dataSource = createDataSource(
- properties, org.apache.commons.dbcp.BasicDataSource.class);
- DatabaseDriver databaseDriver = DatabaseDriver
- .fromJdbcUrl(properties.determineUrl());
- String validationQuery = databaseDriver.getValidationQuery();
- if (validationQuery != null) {
- dataSource.setTestOnBorrow(true);
- dataSource.setValidationQuery(validationQuery);
- }
- return dataSource;
- }
- }
-
@ConditionalOnClass(org.apache.commons.dbcp2.BasicDataSource.class)
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.commons.dbcp2.BasicDataSource", matchIfMissing = true)
static class Dbcp2 extends DataSourceConfiguration {
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java
deleted file mode 100644
index fa1b776fea..0000000000
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2012-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.boot.autoconfigure.jdbc.metadata;
-
-import javax.sql.DataSource;
-
-import org.apache.commons.dbcp.BasicDataSource;
-
-/**
- * {@link DataSourcePoolMetadata} for an Apache Commons DBCP {@link DataSource}.
- *
- * @author Stephane Nicoll
- * @since 1.2.0
- */
-@Deprecated
-public class CommonsDbcpDataSourcePoolMetadata
- extends AbstractDataSourcePoolMetadata {
-
- public CommonsDbcpDataSourcePoolMetadata(BasicDataSource dataSource) {
- super(dataSource);
- }
-
- @Override
- public Integer getActive() {
- return getDataSource().getNumActive();
- }
-
- @Override
- public Integer getMax() {
- return getDataSource().getMaxActive();
- }
-
- @Override
- public Integer getMin() {
- return getDataSource().getMinIdle();
- }
-
- @Override
- public String getValidationQuery() {
- return getDataSource().getValidationQuery();
- }
-
-}
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersConfiguration.java
index fc0ed7ca4e..526c999410 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersConfiguration.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersConfiguration.java
@@ -77,28 +77,6 @@ public class DataSourcePoolMetadataProvidersConfiguration {
}
- @Configuration
- @ConditionalOnClass(org.apache.commons.dbcp.BasicDataSource.class)
- @Deprecated
- static class CommonsDbcpPoolDataSourceMetadataProviderConfiguration {
-
- @Bean
- public DataSourcePoolMetadataProvider commonsDbcpPoolDataSourceMetadataProvider() {
- return new DataSourcePoolMetadataProvider() {
- @Override
- public DataSourcePoolMetadata getDataSourcePoolMetadata(
- DataSource dataSource) {
- if (dataSource instanceof org.apache.commons.dbcp.BasicDataSource) {
- return new CommonsDbcpDataSourcePoolMetadata(
- (org.apache.commons.dbcp.BasicDataSource) dataSource);
- }
- return null;
- }
- };
- }
-
- }
-
@Configuration
@ConditionalOnClass(BasicDataSource.class)
static class CommonsDbcp2PoolDataSourceMetadataProviderConfiguration {
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDbcpDataSourceConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDbcpDataSourceConfigurationTests.java
deleted file mode 100644
index 0735ba0f8b..0000000000
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDbcpDataSourceConfigurationTests.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2012-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.boot.autoconfigure.jdbc;
-
-import javax.sql.DataSource;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.commons.pool.impl.GenericObjectPool;
-import org.junit.Test;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.test.util.EnvironmentTestUtils;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link CommonsDbcpDataSourceConfiguration}.
- *
- * @author Dave Syer
- * @author Stephane Nicoll
- */
-@Deprecated
-public class CommonsDbcpDataSourceConfigurationTests {
-
- private static final String PREFIX = "spring.datasource.dbcp.";
-
- private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
-
- @Test
- public void testDataSourceExists() throws Exception {
- this.context.register(CommonsDbcpDataSourceConfiguration.class);
- this.context.refresh();
- assertThat(this.context.getBean(DataSource.class)).isNotNull();
- this.context.close();
- }
-
- @Test
- public void testDataSourcePropertiesOverridden() throws Exception {
- this.context.register(CommonsDbcpDataSourceConfiguration.class);
- EnvironmentTestUtils.addEnvironment(this.context,
- PREFIX + "url:jdbc:foo//bar/spam");
- EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testWhileIdle:true");
- EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnBorrow:true");
- EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "testOnReturn:true");
- EnvironmentTestUtils.addEnvironment(this.context,
- PREFIX + "timeBetweenEvictionRunsMillis:10000");
- EnvironmentTestUtils.addEnvironment(this.context,
- PREFIX + "minEvictableIdleTimeMillis:12345");
- EnvironmentTestUtils.addEnvironment(this.context, PREFIX + "maxWait:1234");
- this.context.refresh();
- BasicDataSource ds = this.context.getBean(BasicDataSource.class);
- assertThat(ds.getUrl()).isEqualTo("jdbc:foo//bar/spam");
- assertThat(ds.getTestWhileIdle()).isTrue();
- assertThat(ds.getTestOnBorrow()).isTrue();
- assertThat(ds.getTestOnReturn()).isTrue();
- assertThat(ds.getTimeBetweenEvictionRunsMillis()).isEqualTo(10000);
- assertThat(ds.getMinEvictableIdleTimeMillis()).isEqualTo(12345);
- assertThat(ds.getMaxWait()).isEqualTo(1234);
- }
-
- @Test
- public void testDataSourceDefaultsPreserved() throws Exception {
- this.context.register(CommonsDbcpDataSourceConfiguration.class);
- this.context.refresh();
- BasicDataSource ds = this.context.getBean(BasicDataSource.class);
- assertThat(ds.getTimeBetweenEvictionRunsMillis())
- .isEqualTo(GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS);
- assertThat(ds.getMinEvictableIdleTimeMillis())
- .isEqualTo(GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
- assertThat(ds.getMaxWait()).isEqualTo(GenericObjectPool.DEFAULT_MAX_WAIT);
- }
-
- @Configuration
- @EnableConfigurationProperties
- protected static class CommonsDbcpDataSourceConfiguration {
-
- @Bean
- @ConfigurationProperties(prefix = "spring.datasource.dbcp")
- public DataSource dataSource() {
- return DataSourceBuilder.create().type(BasicDataSource.class).build();
- }
-
- }
-
-}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
index 5842663f25..03d6a59545 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
@@ -137,30 +137,10 @@ public class DataSourceAutoConfigurationTests {
// Use Connection#isValid()
}
- @Test
- @Deprecated
- public void commonsDbcpIsFallback() throws Exception {
- org.apache.commons.dbcp.BasicDataSource dataSource = autoConfigureDataSource(
- org.apache.commons.dbcp.BasicDataSource.class,
- "org.apache.tomcat", "com.zaxxer.hikari");
- assertThat(dataSource.getUrl()).isEqualTo("jdbc:hsqldb:mem:testdb");
- }
-
- @Test
- @Deprecated
- public void commonsDbcpValidatesConnectionByDefault() {
- org.apache.commons.dbcp.BasicDataSource dataSource = autoConfigureDataSource(
- org.apache.commons.dbcp.BasicDataSource.class,
- "org.apache.tomcat", "com.zaxxer.hikari");
- assertThat(dataSource.getTestOnBorrow()).isTrue();
- assertThat(dataSource.getValidationQuery())
- .isEqualTo(DatabaseDriver.HSQLDB.getValidationQuery());
- }
-
@Test
public void commonsDbcp2IsFallback() throws Exception {
BasicDataSource dataSource = autoConfigureDataSource(BasicDataSource.class,
- "org.apache.tomcat", "com.zaxxer.hikari", "org.apache.commons.dbcp.");
+ "org.apache.tomcat", "com.zaxxer.hikari");
assertThat(dataSource.getUrl()).isEqualTo("jdbc:hsqldb:mem:testdb");
}
@@ -168,7 +148,7 @@ public class DataSourceAutoConfigurationTests {
public void commonsDbcp2ValidatesConnectionByDefault() throws Exception {
org.apache.commons.dbcp2.BasicDataSource dataSource = autoConfigureDataSource(
org.apache.commons.dbcp2.BasicDataSource.class, "org.apache.tomcat",
- "com.zaxxer.hikari", "org.apache.commons.dbcp.");
+ "com.zaxxer.hikari");
assertThat(dataSource.getTestOnBorrow()).isEqualTo(true);
assertThat(dataSource.getValidationQuery()).isNull(); // Use Connection#isValid()
}
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java
deleted file mode 100644
index a6ac3220d8..0000000000
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2012-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.boot.autoconfigure.jdbc.metadata;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Tests for {@link CommonsDbcpDataSourcePoolMetadata}.
- *
- * @author Stephane Nicoll
- */
-@Deprecated
-public class CommonsDbcpDataSourcePoolMetadataTests
- extends AbstractDataSourcePoolMetadataTests {
-
- private CommonsDbcpDataSourcePoolMetadata dataSourceMetadata;
-
- @Before
- public void setup() {
- this.dataSourceMetadata = createDataSourceMetadata(0, 2);
- }
-
- @Override
- protected CommonsDbcpDataSourcePoolMetadata getDataSourceMetadata() {
- return this.dataSourceMetadata;
- }
-
- @Test
- public void getPoolUsageWithNoCurrent() {
- CommonsDbcpDataSourcePoolMetadata dsm = new CommonsDbcpDataSourcePoolMetadata(
- createDataSource()) {
- @Override
- public Integer getActive() {
- return null;
- }
- };
- assertThat(dsm.getUsage()).isNull();
- }
-
- @Test
- public void getPoolUsageWithNoMax() {
- CommonsDbcpDataSourcePoolMetadata dsm = new CommonsDbcpDataSourcePoolMetadata(
- createDataSource()) {
- @Override
- public Integer getMax() {
- return null;
- }
- };
- assertThat(dsm.getUsage()).isNull();
- }
-
- @Test
- public void getPoolUsageWithUnlimitedPool() {
- DataSourcePoolMetadata unlimitedDataSource = createDataSourceMetadata(0, -1);
- assertThat(unlimitedDataSource.getUsage()).isEqualTo(Float.valueOf(-1F));
- }
-
- @Override
- public void getValidationQuery() {
- BasicDataSource dataSource = createDataSource();
- dataSource.setValidationQuery("SELECT FROM FOO");
- assertThat(new CommonsDbcpDataSourcePoolMetadata(dataSource).getValidationQuery())
- .isEqualTo("SELECT FROM FOO");
- }
-
- private CommonsDbcpDataSourcePoolMetadata createDataSourceMetadata(int minSize,
- int maxSize) {
- BasicDataSource dataSource = createDataSource();
- dataSource.setMinIdle(minSize);
- dataSource.setMaxActive(maxSize);
- return new CommonsDbcpDataSourcePoolMetadata(dataSource);
- }
-
- private BasicDataSource createDataSource() {
- return (BasicDataSource) initializeBuilder().type(BasicDataSource.class).build();
- }
-
-}
diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml
index ecacb79f6e..858c8312c3 100644
--- a/spring-boot-dependencies/pom.xml
+++ b/spring-boot-dependencies/pom.xml
@@ -57,7 +57,6 @@
1.9.2
3.2.2
1.10
- 1.4
2.1.1
2.1
1.6
@@ -823,11 +822,6 @@
commons-codec
${commons-codec.version}
-
- commons-dbcp
- commons-dbcp
- ${commons-dbcp.version}
-
commons-digester
commons-digester
diff --git a/spring-boot-docs/pom.xml b/spring-boot-docs/pom.xml
index 977ec42e10..0680d2169e 100644
--- a/spring-boot-docs/pom.xml
+++ b/spring-boot-docs/pom.xml
@@ -152,11 +152,6 @@
HikariCP
true
-
- commons-dbcp
- commons-dbcp
- true
-
de.flapdoodle.embed
de.flapdoodle.embed.mongo
diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
index 41d46fbc96..1ed899cae6 100644
--- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
@@ -2700,10 +2700,8 @@ Here's the algorithm for choosing a specific implementation:
* We prefer the Tomcat pooling `DataSource` for its performance and concurrency, so if
that is available we always choose it.
* Otherwise, if HikariCP is available we will use it.
-* If neither the Tomcat pooling datasource nor HikariCP are available and if Commons DBCP
- is available we will use it, but we don't recommend it in production and its support
- is deprecated.
-* Lastly, if Commons DBCP2 is available we will use it.
+* If neither the Tomcat pooling datasource nor HikariCP are available and if Commons
+ DBCP2 is available we will use it.
If you use the `spring-boot-starter-jdbc` or `spring-boot-starter-data-jpa`
'`starters`' you will automatically get a dependency to `tomcat-jdbc`.