Class DelegatingDataSource
java.lang.Object
org.springframework.jdbc.datasource.DelegatingDataSource
- All Implemented Interfaces:
- Wrapper,- CommonDataSource,- DataSource,- InitializingBean
- Direct Known Subclasses:
- LazyConnectionDataSourceProxy,- TransactionAwareDataSourceProxy,- UserCredentialsDataSourceAdapter
JDBC 
DataSource implementation that delegates all calls
 to a given target DataSource.
 This class is meant to be subclassed, with subclasses overriding only
 those methods (such as getConnection()) that should not simply
 delegate to the target DataSource.
- Since:
- 1.1
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new DelegatingDataSource.DelegatingDataSource(DataSource targetDataSource) Create a new DelegatingDataSource.
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.getConnection(String username, String password) intReturn the target DataSource that this DataSource should delegate to.booleanisWrapperFor(Class<?> iface) protected DataSourceObtain the targetDataSourcefor actual use (nevernull).voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) voidsetTargetDataSource(DataSource targetDataSource) Set the target DataSource that this DataSource should delegate to.<T> TMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSourcecreateShardingKeyBuilderMethods inherited from interface javax.sql.DataSourcecreateConnectionBuilder
- 
Constructor Details- 
DelegatingDataSourcepublic DelegatingDataSource()Create a new DelegatingDataSource.
- 
DelegatingDataSourceCreate a new DelegatingDataSource.- Parameters:
- targetDataSource- the target DataSource
 
 
- 
- 
Method Details- 
setTargetDataSourceSet the target DataSource that this DataSource should delegate to.
- 
getTargetDataSourceReturn the target DataSource that this DataSource should delegate to.
- 
obtainTargetDataSourceObtain the targetDataSourcefor actual use (nevernull).- Since:
- 5.0
 
- 
afterPropertiesSetpublic void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
 
- 
getConnection- Specified by:
- getConnectionin interface- DataSource
- Throws:
- SQLException
 
- 
getConnection- Specified by:
- getConnectionin interface- DataSource
- Throws:
- SQLException
 
- 
getLogWriter- Specified by:
- getLogWriterin interface- CommonDataSource
- Specified by:
- getLogWriterin interface- DataSource
- Throws:
- SQLException
 
- 
setLogWriter- Specified by:
- setLogWriterin interface- CommonDataSource
- Specified by:
- setLogWriterin interface- DataSource
- Throws:
- SQLException
 
- 
getLoginTimeout- Specified by:
- getLoginTimeoutin interface- CommonDataSource
- Specified by:
- getLoginTimeoutin interface- DataSource
- Throws:
- SQLException
 
- 
setLoginTimeout- Specified by:
- setLoginTimeoutin interface- CommonDataSource
- Specified by:
- setLoginTimeoutin interface- DataSource
- Throws:
- SQLException
 
- 
unwrap- Specified by:
- unwrapin interface- Wrapper
- Throws:
- SQLException
 
- 
isWrapperFor- Specified by:
- isWrapperForin interface- Wrapper
- Throws:
- SQLException
 
- 
getParentLogger- Specified by:
- getParentLoggerin interface- CommonDataSource
 
 
-