package com.yd.util.intercept.commons;

import org.apache.log4j.Logger;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

public class DynamicRoutingDataSource extends AbstractRoutingDataSource {
    private static final Logger LOG = Logger.getLogger(DynamicRoutingDataSource.class);
    @Override
    protected Object determineCurrentLookupKey() {
    	if (DynamicDataSourceContextHolder.get()==null)
    	{
    		DynamicDataSourceContextHolder.set(DataSourceKey.DB_MASTER);
    	}
        
        return DynamicDataSourceContextHolder.get();
    }
}
