@ -16,6 +16,7 @@
@@ -16,6 +16,7 @@
package org.springframework.boot.jdbc ;
import java.beans.PropertyVetoException ;
import java.lang.reflect.Method ;
import java.sql.SQLException ;
import java.util.Collections ;
@ -27,6 +28,7 @@ import java.util.function.Supplier;
@@ -27,6 +28,7 @@ import java.util.function.Supplier;
import javax.sql.DataSource ;
import com.mchange.v2.c3p0.ComboPooledDataSource ;
import com.zaxxer.hikari.HikariDataSource ;
import oracle.jdbc.datasource.OracleDataSource ;
import oracle.ucp.jdbc.PoolDataSource ;
@ -391,6 +393,8 @@ public final class DataSourceBuilder<T extends DataSource> {
@@ -391,6 +393,8 @@ public final class DataSourceBuilder<T extends DataSource> {
MappedDbcp2DataSource : : new ) ;
result = lookup ( classLoader , type , result , "oracle.ucp.jdbc.PoolDataSourceImpl" ,
OraclePoolDataSourceProperties : : new , "oracle.jdbc.OracleConnection" ) ;
result = lookup ( classLoader , type , result , "com.mchange.v2.c3p0.ComboPooledDataSource" ,
ComboPooledDataSourceProperties : : new ) ;
return result ;
}
@ -650,6 +654,29 @@ public final class DataSourceBuilder<T extends DataSource> {
@@ -650,6 +654,29 @@ public final class DataSourceBuilder<T extends DataSource> {
}
/ * *
* { @link DataSourceProperties } for C3P0 .
* /
private static class ComboPooledDataSourceProperties extends MappedDataSourceProperties < ComboPooledDataSource > {
ComboPooledDataSourceProperties ( ) {
add ( DataSourceProperty . URL , ComboPooledDataSource : : getJdbcUrl , ComboPooledDataSource : : setJdbcUrl ) ;
add ( DataSourceProperty . DRIVER_CLASS_NAME , ComboPooledDataSource : : getDriverClass , this : : setDriverClass ) ;
add ( DataSourceProperty . USERNAME , ComboPooledDataSource : : getUser , ComboPooledDataSource : : setUser ) ;
add ( DataSourceProperty . PASSWORD , ComboPooledDataSource : : getPassword , ComboPooledDataSource : : setPassword ) ;
}
private void setDriverClass ( ComboPooledDataSource dataSource , String driverClass ) {
try {
dataSource . setDriverClass ( driverClass ) ;
}
catch ( PropertyVetoException ex ) {
throw new IllegalArgumentException ( ex ) ;
}
}
}
/ * *
* { @link DataSourceProperties } for Spring ' s { @link SimpleDriverDataSource } .
* /