public class RlDynamicDataSource
extends org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
implements org.springframework.context.ApplicationContextAware
| 构造器和说明 |
|---|
RlDynamicDataSource() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
clearDataSource() |
protected Object |
determineCurrentLookupKey()
每一次执行SQL语句之前都会执行此方法,以确定本次访问数据库所对应的数据源的key
这里将数据源的bean name作为数据源的key 以方便后续调度数据数据源
|
static String |
getDataSource() |
Map<Object,Object> |
getTargetSource()
通过反射获取AbstractRoutingDataSource的targetDataSources属性
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
static void |
setDataSource(String dataSource) |
afterPropertiesSet, determineTargetDataSource, getConnection, getConnection, getResolvedDataSources, getResolvedDefaultDataSource, isWrapperFor, resolveSpecifiedDataSource, resolveSpecifiedLookupKey, setDataSourceLookup, setDefaultTargetDataSource, setLenientFallback, setTargetDataSources, unwrapprotected Object determineCurrentLookupKey()
determineCurrentLookupKey 在类中 org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSourcepublic static void setDataSource(String dataSource)
public static String getDataSource()
public static void clearDataSource()
public Map<Object,Object> getTargetSource() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
NoSuchFieldExceptionSecurityExceptionIllegalArgumentExceptionIllegalAccessExceptionpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext 在接口中 org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionCopyright © 2023. All rights reserved.