mirror of
https://github.com/drtrang/druid-spring-boot.git
synced 2026-11-02 15:03:41 +00:00
remove useless defaultTargetDataSource
This commit is contained in:
+1
-4
@@ -18,11 +18,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||
|
||||
private AtomicInteger count = new AtomicInteger();
|
||||
private DataSource defaultTargetDataSource;
|
||||
@Getter private Map<String, DataSource> targetDataSources;
|
||||
|
||||
public DynamicDataSource(DataSource defaultTargetDataSource, Map<String, DataSource> targetDataSources) {
|
||||
this.defaultTargetDataSource = defaultTargetDataSource;
|
||||
public DynamicDataSource(Map<String, DataSource> targetDataSources) {
|
||||
this.targetDataSources = targetDataSources;
|
||||
}
|
||||
|
||||
@@ -35,7 +33,6 @@ public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
super.setDefaultTargetDataSource(defaultTargetDataSource);
|
||||
super.setTargetDataSources(new HashMap<>(targetDataSources));
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class SpringDataSourceConfig {
|
||||
@Primary
|
||||
public DynamicDataSource dataSource(Map<String, DruidDataSource> druidDataSourceMap) {
|
||||
Map<String, DataSource> dataSourceMap = new HashMap<>(druidDataSourceMap);
|
||||
return new DynamicDataSource(dataSourceMap.get("master"), dataSourceMap);
|
||||
return new DynamicDataSource(dataSourceMap);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user