Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
543498f0
Commit
543498f0
authored
Oct 05, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
4119da1d
cf28663c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
35 additions
and
27 deletions
+35
-27
pom.xml
spring-boot-actuator/pom.xml
+2
-2
PublicMetricsAutoConfigurationTests.java
...te/autoconfigure/PublicMetricsAutoConfigurationTests.java
+1
-1
DataSourceBuilder.java
...gframework/boot/autoconfigure/jdbc/DataSourceBuilder.java
+1
-1
DataSourceConfiguration.java
...work/boot/autoconfigure/jdbc/DataSourceConfiguration.java
+1
-0
CommonsDbcpDataSourcePoolMetadata.java
...gure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java
+2
-1
DataSourcePoolMetadataProvidersConfiguration.java
...etadata/DataSourcePoolMetadataProvidersConfiguration.java
+9
-8
CommonsDbcpDataSourceConfigurationTests.java
...nfigure/jdbc/CommonsDbcpDataSourceConfigurationTests.java
+1
-0
DataSourceAutoConfigurationTests.java
.../autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
+9
-6
JdbcTemplateAutoConfigurationTests.java
...utoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java
+1
-1
JndiDataSourceAutoConfigurationTests.java
...oconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java
+2
-1
TestDataSource.java
...ringframework/boot/autoconfigure/jdbc/TestDataSource.java
+1
-1
CommonsDbcpDataSourcePoolMetadataTests.java
...jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java
+1
-0
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+0
-1
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+4
-4
No files found.
spring-boot-actuator/pom.xml
View file @
543498f0
...
@@ -275,8 +275,8 @@
...
@@ -275,8 +275,8 @@
<optional>
true
</optional>
<optional>
true
</optional>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
commons-dbcp
</groupId>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-dbcp
</artifactId>
<artifactId>
commons-dbcp
2
</artifactId>
<optional>
true
</optional>
<optional>
true
</optional>
</dependency>
</dependency>
<!-- Annotation processing -->
<!-- Annotation processing -->
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java
View file @
543498f0
...
@@ -26,7 +26,7 @@ import java.util.Map;
...
@@ -26,7 +26,7 @@ import java.util.Map;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.apache.commons.dbcp.BasicDataSource
;
import
org.apache.commons.dbcp
2
.BasicDataSource
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.junit.Test
;
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceBuilder.java
View file @
543498f0
...
@@ -44,7 +44,7 @@ public class DataSourceBuilder {
...
@@ -44,7 +44,7 @@ public class DataSourceBuilder {
private
static
final
String
[]
DATA_SOURCE_TYPE_NAMES
=
new
String
[]
{
private
static
final
String
[]
DATA_SOURCE_TYPE_NAMES
=
new
String
[]
{
"org.apache.tomcat.jdbc.pool.DataSource"
,
"org.apache.tomcat.jdbc.pool.DataSource"
,
"com.zaxxer.hikari.HikariDataSource"
,
"com.zaxxer.hikari.HikariDataSource"
,
"org.apache.commons.dbcp.BasicDataSource"
,
"org.apache.commons.dbcp.BasicDataSource"
,
//deprecated
"org.apache.commons.dbcp2.BasicDataSource"
};
"org.apache.commons.dbcp2.BasicDataSource"
};
private
Class
<?
extends
DataSource
>
type
;
private
Class
<?
extends
DataSource
>
type
;
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration.java
View file @
543498f0
...
@@ -77,6 +77,7 @@ abstract class DataSourceConfiguration {
...
@@ -77,6 +77,7 @@ abstract class DataSourceConfiguration {
@ConditionalOnClass
(
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
.
class
)
@ConditionalOnClass
(
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
.
class
)
@ConditionalOnProperty
(
name
=
"spring.datasource.type"
,
havingValue
=
"org.apache.commons.dbcp.BasicDataSource"
,
matchIfMissing
=
true
)
@ConditionalOnProperty
(
name
=
"spring.datasource.type"
,
havingValue
=
"org.apache.commons.dbcp.BasicDataSource"
,
matchIfMissing
=
true
)
@Deprecated
static
class
Dbcp
extends
DataSourceConfiguration
{
static
class
Dbcp
extends
DataSourceConfiguration
{
@Bean
@Bean
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadata.java
View file @
543498f0
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -26,6 +26,7 @@ import org.apache.commons.dbcp.BasicDataSource;
...
@@ -26,6 +26,7 @@ import org.apache.commons.dbcp.BasicDataSource;
* @author Stephane Nicoll
* @author Stephane Nicoll
* @since 1.2.0
* @since 1.2.0
*/
*/
@Deprecated
public
class
CommonsDbcpDataSourcePoolMetadata
public
class
CommonsDbcpDataSourcePoolMetadata
extends
AbstractDataSourcePoolMetadata
<
BasicDataSource
>
{
extends
AbstractDataSourcePoolMetadata
<
BasicDataSource
>
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvidersConfiguration.java
View file @
543498f0
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -19,7 +19,7 @@ package org.springframework.boot.autoconfigure.jdbc.metadata;
...
@@ -19,7 +19,7 @@ package org.springframework.boot.autoconfigure.jdbc.metadata;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.apache.commons.dbcp.BasicDataSource
;
import
org.apache.commons.dbcp
2
.BasicDataSource
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -78,7 +78,8 @@ public class DataSourcePoolMetadataProvidersConfiguration {
...
@@ -78,7 +78,8 @@ public class DataSourcePoolMetadataProvidersConfiguration {
}
}
@Configuration
@Configuration
@ConditionalOnClass
(
BasicDataSource
.
class
)
@ConditionalOnClass
(
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
.
class
)
@Deprecated
static
class
CommonsDbcpPoolDataSourceMetadataProviderConfiguration
{
static
class
CommonsDbcpPoolDataSourceMetadataProviderConfiguration
{
@Bean
@Bean
...
@@ -87,9 +88,9 @@ public class DataSourcePoolMetadataProvidersConfiguration {
...
@@ -87,9 +88,9 @@ public class DataSourcePoolMetadataProvidersConfiguration {
@Override
@Override
public
DataSourcePoolMetadata
getDataSourcePoolMetadata
(
public
DataSourcePoolMetadata
getDataSourcePoolMetadata
(
DataSource
dataSource
)
{
DataSource
dataSource
)
{
if
(
dataSource
instanceof
BasicDataSource
)
{
if
(
dataSource
instanceof
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
)
{
return
new
CommonsDbcpDataSourcePoolMetadata
(
return
new
CommonsDbcpDataSourcePoolMetadata
(
(
BasicDataSource
)
dataSource
);
(
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
)
dataSource
);
}
}
return
null
;
return
null
;
}
}
...
@@ -99,7 +100,7 @@ public class DataSourcePoolMetadataProvidersConfiguration {
...
@@ -99,7 +100,7 @@ public class DataSourcePoolMetadataProvidersConfiguration {
}
}
@Configuration
@Configuration
@ConditionalOnClass
(
org
.
apache
.
commons
.
dbcp2
.
BasicDataSource
.
class
)
@ConditionalOnClass
(
BasicDataSource
.
class
)
static
class
CommonsDbcp2PoolDataSourceMetadataProviderConfiguration
{
static
class
CommonsDbcp2PoolDataSourceMetadataProviderConfiguration
{
@Bean
@Bean
...
@@ -108,9 +109,9 @@ public class DataSourcePoolMetadataProvidersConfiguration {
...
@@ -108,9 +109,9 @@ public class DataSourcePoolMetadataProvidersConfiguration {
@Override
@Override
public
DataSourcePoolMetadata
getDataSourcePoolMetadata
(
public
DataSourcePoolMetadata
getDataSourcePoolMetadata
(
DataSource
dataSource
)
{
DataSource
dataSource
)
{
if
(
dataSource
instanceof
org
.
apache
.
commons
.
dbcp2
.
BasicDataSource
)
{
if
(
dataSource
instanceof
BasicDataSource
)
{
return
new
CommonsDbcp2DataSourcePoolMetadata
(
return
new
CommonsDbcp2DataSourcePoolMetadata
(
(
org
.
apache
.
commons
.
dbcp2
.
BasicDataSource
)
dataSource
);
(
BasicDataSource
)
dataSource
);
}
}
return
null
;
return
null
;
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/CommonsDbcpDataSourceConfigurationTests.java
View file @
543498f0
...
@@ -37,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -37,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
* @author Dave Syer
* @author Stephane Nicoll
* @author Stephane Nicoll
*/
*/
@Deprecated
public
class
CommonsDbcpDataSourceConfigurationTests
{
public
class
CommonsDbcpDataSourceConfigurationTests
{
private
static
final
String
PREFIX
=
"spring.datasource.dbcp."
;
private
static
final
String
PREFIX
=
"spring.datasource.dbcp."
;
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfigurationTests.java
View file @
543498f0
...
@@ -30,7 +30,7 @@ import java.util.logging.Logger;
...
@@ -30,7 +30,7 @@ import java.util.logging.Logger;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.apache.commons.dbcp.BasicDataSource
;
import
org.apache.commons.dbcp
2
.BasicDataSource
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -138,15 +138,19 @@ public class DataSourceAutoConfigurationTests {
...
@@ -138,15 +138,19 @@ public class DataSourceAutoConfigurationTests {
}
}
@Test
@Test
@Deprecated
public
void
commonsDbcpIsFallback
()
throws
Exception
{
public
void
commonsDbcpIsFallback
()
throws
Exception
{
BasicDataSource
dataSource
=
autoConfigureDataSource
(
BasicDataSource
.
class
,
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
dataSource
=
autoConfigureDataSource
(
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
.
class
,
"org.apache.tomcat"
,
"com.zaxxer.hikari"
);
"org.apache.tomcat"
,
"com.zaxxer.hikari"
);
assertThat
(
dataSource
.
getUrl
()).
isEqualTo
(
"jdbc:hsqldb:mem:testdb"
);
assertThat
(
dataSource
.
getUrl
()).
isEqualTo
(
"jdbc:hsqldb:mem:testdb"
);
}
}
@Test
@Test
@Deprecated
public
void
commonsDbcpValidatesConnectionByDefault
()
{
public
void
commonsDbcpValidatesConnectionByDefault
()
{
BasicDataSource
dataSource
=
autoConfigureDataSource
(
BasicDataSource
.
class
,
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
dataSource
=
autoConfigureDataSource
(
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
.
class
,
"org.apache.tomcat"
,
"com.zaxxer.hikari"
);
"org.apache.tomcat"
,
"com.zaxxer.hikari"
);
assertThat
(
dataSource
.
getTestOnBorrow
()).
isTrue
();
assertThat
(
dataSource
.
getTestOnBorrow
()).
isTrue
();
assertThat
(
dataSource
.
getValidationQuery
())
assertThat
(
dataSource
.
getValidationQuery
())
...
@@ -155,9 +159,8 @@ public class DataSourceAutoConfigurationTests {
...
@@ -155,9 +159,8 @@ public class DataSourceAutoConfigurationTests {
@Test
@Test
public
void
commonsDbcp2IsFallback
()
throws
Exception
{
public
void
commonsDbcp2IsFallback
()
throws
Exception
{
org
.
apache
.
commons
.
dbcp2
.
BasicDataSource
dataSource
=
autoConfigureDataSource
(
BasicDataSource
dataSource
=
autoConfigureDataSource
(
BasicDataSource
.
class
,
org
.
apache
.
commons
.
dbcp2
.
BasicDataSource
.
class
,
"org.apache.tomcat"
,
"org.apache.tomcat"
,
"com.zaxxer.hikari"
,
"org.apache.commons.dbcp."
);
"com.zaxxer.hikari"
,
"org.apache.commons.dbcp."
);
assertThat
(
dataSource
.
getUrl
()).
isEqualTo
(
"jdbc:hsqldb:mem:testdb"
);
assertThat
(
dataSource
.
getUrl
()).
isEqualTo
(
"jdbc:hsqldb:mem:testdb"
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JdbcTemplateAutoConfigurationTests.java
View file @
543498f0
...
@@ -20,7 +20,7 @@ import java.util.Random;
...
@@ -20,7 +20,7 @@ import java.util.Random;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
org.apache.commons.dbcp.BasicDataSource
;
import
org.apache.commons.dbcp
2
.BasicDataSource
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java
View file @
543498f0
...
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
...
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.jmx.export.MBeanExporter
;
import
org.springframework.jmx.export.MBeanExporter
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
/**
* Tests for {@link JndiDataSourceAutoConfiguration}
* Tests for {@link JndiDataSourceAutoConfiguration}
...
@@ -120,7 +121,7 @@ public class JndiDataSourceAutoConfigurationTests {
...
@@ -120,7 +121,7 @@ public class JndiDataSourceAutoConfigurationTests {
@Test
@Test
public
void
standardDataSourceIsNotExcludedFromExport
()
public
void
standardDataSourceIsNotExcludedFromExport
()
throws
IllegalStateException
,
NamingException
{
throws
IllegalStateException
,
NamingException
{
DataSource
dataSource
=
new
org
.
apache
.
commons
.
dbcp
.
BasicDataSource
(
);
DataSource
dataSource
=
mock
(
DataSource
.
class
);
configureJndi
(
"foo"
,
dataSource
);
configureJndi
(
"foo"
,
dataSource
);
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/TestDataSource.java
View file @
543498f0
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
jdbc
;
package
org
.
springframework
.
boot
.
autoconfigure
.
jdbc
;
import
org.apache.commons.dbcp.BasicDataSource
;
import
org.apache.commons.dbcp
2
.BasicDataSource
;
/**
/**
* {@link BasicDataSource} used for testing.
* {@link BasicDataSource} used for testing.
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/metadata/CommonsDbcpDataSourcePoolMetadataTests.java
View file @
543498f0
...
@@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
*
* @author Stephane Nicoll
* @author Stephane Nicoll
*/
*/
@Deprecated
public
class
CommonsDbcpDataSourcePoolMetadataTests
public
class
CommonsDbcpDataSourcePoolMetadataTests
extends
AbstractDataSourcePoolMetadataTests
<
CommonsDbcpDataSourcePoolMetadata
>
{
extends
AbstractDataSourcePoolMetadataTests
<
CommonsDbcpDataSourcePoolMetadata
>
{
...
...
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
543498f0
...
@@ -593,7 +593,6 @@ content into your application; rather pick only the properties that you need.
...
@@ -593,7 +593,6 @@ content into your application; rather pick only the properties that you need.
spring.datasource.data= # Data (DML) script resource reference.
spring.datasource.data= # Data (DML) script resource reference.
spring.datasource.data-username= # User of the database to execute DML scripts (if different).
spring.datasource.data-username= # User of the database to execute DML scripts (if different).
spring.datasource.data-password= # Password of the database to execute DML scripts (if different).
spring.datasource.data-password= # Password of the database to execute DML scripts (if different).
spring.datasource.dbcp.*= # Commons DBCP specific settings
spring.datasource.dbcp2.*= # Commons DBCP2 specific settings
spring.datasource.dbcp2.*= # Commons DBCP2 specific settings
spring.datasource.driver-class-name= # Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.
spring.datasource.driver-class-name= # Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.
spring.datasource.hikari.*= # Hikari specific settings
spring.datasource.hikari.*= # Hikari specific settings
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
543498f0
...
@@ -2701,7 +2701,8 @@ Here's the algorithm for choosing a specific implementation:
...
@@ -2701,7 +2701,8 @@ Here's the algorithm for choosing a specific implementation:
that is available we always choose it.
that is available we always choose it.
* Otherwise, if HikariCP is available we will use it.
* Otherwise, if HikariCP is available we will use it.
* If neither the Tomcat pooling datasource nor HikariCP are available and if Commons DBCP
* 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.
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.
* Lastly, if Commons DBCP2 is available we will use it.
If you use the `spring-boot-starter-jdbc` or `spring-boot-starter-data-jpa`
If you use the `spring-boot-starter-jdbc` or `spring-boot-starter-data-jpa`
...
@@ -2741,9 +2742,8 @@ See {sc-spring-boot-autoconfigure}/jdbc/DataSourceProperties.{sc-ext}[`DataSourc
...
@@ -2741,9 +2742,8 @@ See {sc-spring-boot-autoconfigure}/jdbc/DataSourceProperties.{sc-ext}[`DataSourc
for more of the supported options. These are the standard options that work regardless of
for more of the supported options. These are the standard options that work regardless of
the actual implementation. It is also possible to fine-tune implementation-specific
the actual implementation. It is also possible to fine-tune implementation-specific
settings using their respective prefix (`+spring.datasource.tomcat.*+`,
settings using their respective prefix (`+spring.datasource.tomcat.*+`,
`+spring.datasource.hikari.*+`, `+spring.datasource.dbcp.*+` and
`+spring.datasource.hikari.*+`, and `+spring.datasource.dbcp2.*+`). Refer to the
`+spring.datasource.dbcp2.*+`). Refer to the documentation of the connection pool
documentation of the connection pool implementation you are using for more details.
implementation you are using for more details.
For instance, if you are using the
For instance, if you are using the
http://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html#Common_Attributes[Tomcat connection pool]
http://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html#Common_Attributes[Tomcat connection pool]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment