public class DynamicDataSource extends AbstractRoutingDataSource implements javax.sql.DataSource
defaultTargetDataSource, strict, targetDataSources
构造器和说明 |
---|
DynamicDataSource() |
DynamicDataSource(java.util.Properties props) |
限定符和类型 | 方法和说明 |
---|---|
void |
addTargetDataSource(java.lang.String name,
javax.sql.DataSource dataSource)
添加目标数据源
|
void |
addTargetDataSourceAll(java.util.Map<java.lang.String,javax.sql.DataSource> targetDataSources)
添加目标数据源集合
|
java.lang.String |
determineCurrentKey()
确定当前数据源键
|
javax.sql.DataSource |
getDefaultTargetDataSource()
获取数据源
|
javax.sql.DataSource |
getTargetDataSource(java.lang.String name)
获取数据源
|
void |
removeTargetDataSource(java.lang.String name)
移除数据源
|
void |
setCurrentKey(java.lang.String name)
设置当前数据源名
|
close, closeDataSource, determineCurrentTarget, getConnection, getConnection, getLoginTimeout, getLogWriter, getParentLogger, isWrapperFor, setDefaultTargetDataSource, setLoginTimeout, setLogWriter, setStrict, setTargetDataSources, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DynamicDataSource()
public DynamicDataSource(java.util.Properties props)
public void addTargetDataSource(java.lang.String name, javax.sql.DataSource dataSource)
public void addTargetDataSourceAll(java.util.Map<java.lang.String,javax.sql.DataSource> targetDataSources)
public void removeTargetDataSource(java.lang.String name) throws java.io.IOException
java.io.IOException
@Nullable public javax.sql.DataSource getTargetDataSource(java.lang.String name)
public javax.sql.DataSource getDefaultTargetDataSource()
public void setCurrentKey(java.lang.String name)
public java.lang.String determineCurrentKey()
AbstractRoutingDataSource