diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java index e1dce396d8ad4..baa1a2109b08e 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java @@ -61,7 +61,8 @@ public static Collection build(final String databaseName, fi for (Entry entry : getRuleBuilderMap(databaseConfig).entrySet()) { RuleConfigurationChecker configChecker = OrderedSPILoader.getServicesByClass( RuleConfigurationChecker.class, Collections.singleton(entry.getKey().getClass())).get(entry.getKey().getClass()); - Map dataSources = databaseConfig.getStorageUnits().entrySet().stream().collect(Collectors.toMap(Entry::getKey, storageUnit -> storageUnit.getValue().getDataSource())); + Map dataSources = databaseConfig.getStorageUnits().entrySet().stream() + .collect(Collectors.toMap(Entry::getKey, storageUnit -> storageUnit.getValue().getDataSource(), (oldValue, currentValue) -> oldValue, LinkedHashMap::new)); if (null != configChecker) { configChecker.check(databaseName, entry.getKey(), dataSources, result); }