类 DelegatingDataSource
- java.lang.Object
- org.springframework.jdbc.datasource.DelegatingDataSource
- 所有已实现的接口:
Wrapper
,CommonDataSource
,DataSource
,InitializingBean
- 直接已知子类:
LazyConnectionDataSourceProxy
,TransactionAwareDataSourceProxy
,UserCredentialsDataSourceAdapter
public class DelegatingDataSource extends Object implements DataSource, InitializingBean
JDBCDataSource
implementation that delegates all calls to a given targetDataSource
.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.- 从以下版本开始:
- 1.1
- 作者:
- Juergen Hoeller
- 另请参阅:
getConnection()
构造器概要
构造器 构造器 说明 DelegatingDataSource()
Create a new DelegatingDataSource.DelegatingDataSource(DataSource targetDataSource)
Create a new DelegatingDataSource.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.Connection
getConnection()
Connection
getConnection(String username, String password)
int
getLoginTimeout()
PrintWriter
getLogWriter()
Logger
getParentLogger()
DataSource
getTargetDataSource()
Return the target DataSource that this DataSource should delegate to.boolean
isWrapperFor(Class<?> iface)
void
setLoginTimeout(int seconds)
void
setLogWriter(PrintWriter out)
void
setTargetDataSource(DataSource targetDataSource)
Set the target DataSource that this DataSource should delegate to.<T> T
unwrap(Class<T> iface)
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 javax.sql.CommonDataSource
createShardingKeyBuilder
从接口继承的方法 javax.sql.DataSource
createConnectionBuilder
构造器详细资料
DelegatingDataSource
public DelegatingDataSource()
Create a new DelegatingDataSource.
DelegatingDataSource
public DelegatingDataSource(DataSource targetDataSource)
Create a new DelegatingDataSource.- 参数:
targetDataSource
- the target DataSource
方法详细资料
setTargetDataSource
public void setTargetDataSource(DataSource targetDataSource)
Set the target DataSource that this DataSource should delegate to.
getTargetDataSource
public DataSource getTargetDataSource()
Return the target DataSource that this DataSource should delegate to.
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet
在接口中InitializingBean
getConnection
public Connection getConnection() throws SQLException
- 指定者:
getConnection
在接口中DataSource
- 抛出:
SQLException
getConnection
public Connection getConnection(String username, String password) throws SQLException
- 指定者:
getConnection
在接口中DataSource
- 抛出:
SQLException
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- 指定者:
getLogWriter
在接口中CommonDataSource
- 指定者:
getLogWriter
在接口中DataSource
- 抛出:
SQLException
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- 指定者:
setLogWriter
在接口中CommonDataSource
- 指定者:
setLogWriter
在接口中DataSource
- 抛出:
SQLException
getLoginTimeout
public int getLoginTimeout() throws SQLException
- 指定者:
getLoginTimeout
在接口中CommonDataSource
- 指定者:
getLoginTimeout
在接口中DataSource
- 抛出:
SQLException
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException
- 指定者:
setLoginTimeout
在接口中CommonDataSource
- 指定者:
setLoginTimeout
在接口中DataSource
- 抛出:
SQLException
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- 指定者:
unwrap
在接口中Wrapper
- 抛出:
SQLException
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- 指定者:
isWrapperFor
在接口中Wrapper
- 抛出:
SQLException
getParentLogger
public Logger getParentLogger()
- 指定者:
getParentLogger
在接口中CommonDataSource