Administrator
2024-08-05 faf02e3bad9fe25c60acf9a8be7e58122a4cec4a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package com.dy.common.multiDataSource;
 
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
 
public class MultiDataSource extends AbstractRoutingDataSource {
 
    /**
     * 实现多数据源接口的determineCurrentLookupKey方法
     * 以供其他部分调用,以确定当前所连接的数据库及数据源。
     * @return
     */
    @Override
    protected Object determineCurrentLookupKey() {
        return DataSourceContext.get();
    }
 
}