Add destroyMethods to DataSources

This commit is contained in:
Dave Syer 2014-01-24 18:19:20 +00:00
parent c5584b490a
commit 19ca4d4eae
3 changed files with 4 additions and 3 deletions

View File

@ -47,7 +47,7 @@ public class CommonsDataSourceConfiguration extends AbstractDataSourceConfigurat
setInitialSize(0);
}
@Bean
@Bean(destroyMethod = "close")
public DataSource dataSource() {
logger.info("Hint: using Commons DBCP BasicDataSource. It's going to work, "
+ "but the Tomcat DataSource is more reliable.");

View File

@ -36,7 +36,8 @@ public enum EmbeddedDatabaseConnection {
/**
* H2 Database Connection.
*/
H2(EmbeddedDatabaseType.H2, "org.h2.Driver", "jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1"),
H2(EmbeddedDatabaseType.H2, "org.h2.Driver",
"jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"),
/**
* Derby Database Connection.

View File

@ -34,7 +34,7 @@ public class TomcatDataSourceConfiguration extends AbstractDataSourceConfigurati
private org.apache.tomcat.jdbc.pool.DataSource pool;
@Bean
@Bean(destroyMethod = "close")
public DataSource dataSource() {
this.pool = new org.apache.tomcat.jdbc.pool.DataSource();
this.pool.setDriverClassName(getDriverClassName());