org.jeecgframework.minidao.datasource.DynamicDataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minidao-pe Show documentation
Show all versions of minidao-pe Show documentation
An powerful enhanced toolkit of SpringJdbc for simplify development
The newest version!
package org.jeecgframework.minidao.datasource;
import java.util.Map;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
import org.springframework.jdbc.datasource.lookup.DataSourceLookup;
/**
* 类名:DynamicDataSource.java 功能:动态数据源类
*/
public class DynamicDataSource extends AbstractRoutingDataSource {
/*
* 该方法必须要重写 方法是为了根据数据库标示符取得当前的数据库
*/
@Override
protected Object determineCurrentLookupKey() {
DataSourceType dataSourceType = DataSourceContextHolder
.getDataSourceType();
return dataSourceType;
}
@Override
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) {
super.setDataSourceLookup(dataSourceLookup);
}
@Override
public void setDefaultTargetDataSource(Object defaultTargetDataSource) {
super.setDefaultTargetDataSource(defaultTargetDataSource);
}
@Override
public void setTargetDataSources(Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy