org.jeecgframework.minidao.datasource.DataSourceContextHolder 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;
/**
* 类名:DataSourceContextHolder.java 功能:获得和设置上下文环境的类,主要负责改变上下文数据源的名称
* DataSourceContextHolder
*
* @description:DataSourceContextHolder
* @author 张代浩
* @mail [email protected]
* @category www.jeecg.com
* @date 20130817
* @version V1.0
*/
public class DataSourceContextHolder {
private static final ThreadLocal contextHolder = new ThreadLocal();
public static void clearDataSourceType() {
contextHolder.remove();
}
public static DataSourceType getDataSourceType() {
return (DataSourceType) contextHolder.get();
}
public static void setDataSourceType(DataSourceType dataSourceType) {
contextHolder.set(dataSourceType);
}
}