public class DynamicDataSource
extends org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
| 构造器和说明 |
|---|
DynamicDataSource(DataSource defaultDataSource) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
addAndSwitchDataSource(DataSourceInfo dataSourceInfo,
Boolean overwrite)
Add a new datasource and switch to it
|
boolean |
addDataSource(DataSourceInfo dataSourceInfo,
Boolean overwrite)
Add a new datasource
|
boolean |
delDataSource(String dataSourceName)
Del a datasource by name.
|
Object |
determineCurrentLookupKey() |
DataSource |
getDefaultDataSource()
Get default datasource
|
boolean |
switchDataSource(String dataSourceName)
Switch to a datasource
|
afterPropertiesSet, determineTargetDataSource, getConnection, getConnection, isWrapperFor, resolveSpecifiedDataSource, resolveSpecifiedLookupKey, setDataSourceLookup, setDefaultTargetDataSource, setLenientFallback, setTargetDataSources, unwrappublic DynamicDataSource(DataSource defaultDataSource)
public Object determineCurrentLookupKey()
determineCurrentLookupKey 在类中 org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSourcepublic boolean addDataSource(DataSourceInfo dataSourceInfo, Boolean overwrite)
dataSourceInfo - Datasource info to create new datasourceoverwrite - Whether to allow overwriting if a datasource with the same name already existspublic boolean addAndSwitchDataSource(DataSourceInfo dataSourceInfo, Boolean overwrite)
dataSourceInfo - Datasource info to create new databaseoverwrite - If a datasource with the same name already exists, whether to allow overwriting before switching.public boolean switchDataSource(String dataSourceName)
dataSourceName - The name of the data source to be switched topublic boolean delDataSource(String dataSourceName)
dataSourceName - The name of datasource to be deletedpublic DataSource getDefaultDataSource()
Copyright © 2020. All rights reserved.