package com.emr.annotation;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @ProjectName:
 * @Description:
 * @Param 传输参数
 * @Return
 * @Author: 曾文和
 * @CreateDate: 2020/1/17 12:02
 * @UpdateUser: 曾文和
 * @UpdateDate: 2020/1/17 12:02
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class DynamicDataSource  extends AbstractRoutingDataSource {
    private static final Logger log = LoggerFactory.getLogger(DynamicDataSource.class);
    @Override
    protected Object determineCurrentLookupKey() {
        log.info("Current DataSource is " + DynamicDataSourceContextHolder.getDB());
        return DynamicDataSourceContextHolder.getDB();
    }
}
