This is an automated email from the ASF dual-hosted git repository.

terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 22278bea8b1 Use Bean Validation for Proxy configuration load results 
(#40056)
22278bea8b1 is described below

commit 22278bea8b1e9476b5f71e40c75ce5131a788981
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Oct 5 15:03:32 2026 +0800

    Use Bean Validation for Proxy configuration load results (#40056)
---
 .../reachability-metadata.json                     | 207 +++++++++++++++++++++
 ...tion.java => ProxyConfigurationLoadResult.java} |   6 +-
 .../backend/config/ProxyConfigurationLoader.java   |  11 +-
 .../checker/YamlProxyConfigurationChecker.java     |  52 ------
 .../ProxyConfigurationLoadResultValidator.java     |  61 ++++++
 .../constraint/NoConflictingDataSourceNames.java   |  57 ++++++
 .../NoConflictingDataSourceNamesValidator.java     |  64 +++++++
 .../swapper/YamlProxyConfigurationSwapper.java     |  12 +-
 .../config/ProxyConfigurationLoaderTest.java       |  23 ++-
 .../checker/YamlProxyConfigurationCheckerTest.java |  54 ------
 .../ProxyConfigurationLoadResultValidatorTest.java |  95 ++++++++++
 .../NoConflictingDataSourceNamesValidatorTest.java | 136 ++++++++++++++
 .../swapper/YamlProxyConfigurationSwapperTest.java |   6 +-
 ...amlProxyDataSourceConfigurationSwapperTest.java |   6 +-
 .../org/apache/shardingsphere/proxy/Bootstrap.java |  10 +-
 .../proxy/initializer/BootstrapInitializer.java    |  10 +-
 .../initializer/BootstrapInitializerTest.java      |  16 +-
 .../impl/ShardingSphereProxyEmbeddedContainer.java |   6 +-
 .../natived/commons/util/ProxyTestingServer.java   |   8 +-
 19 files changed, 683 insertions(+), 157 deletions(-)

diff --git 
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/infra-reachability-metadata/reachability-metadata.json
 
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/infra-reachability-metadata/reachability-metadata.json
index 6e44e9493e8..d5982bdd347 100644
--- 
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/infra-reachability-metadata/reachability-metadata.json
+++ 
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/infra-reachability-metadata/reachability-metadata.json
@@ -265,6 +265,201 @@
         }
       ]
     },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.ApacheValidatorFactory",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": [
+            "javax.validation.spi.ConfigurationState"
+          ]
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.ConstraintAnnotationAttributes$Types",
+      "fields": [
+        {
+          "name": "message"
+        },
+        {
+          "name": "groups"
+        },
+        {
+          "name": "payload"
+        },
+        {
+          "name": "validationAppliesTo"
+        },
+        {
+          "name": "value"
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.FxExtractor$Activation",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.IterableElementExtractor",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.ListElementExtractor",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.MapExtractor"
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.MapExtractor$ForKey",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.MapExtractor$ForValue",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.OptionalExtractor"
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": 
"org.apache.bval.jsr.valueextraction.OptionalExtractor$ForDouble",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.OptionalExtractor$ForInt",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": "org.apache.bval.jsr.valueextraction.OptionalExtractor$ForLong",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": 
"org.apache.bval.jsr.valueextraction.OptionalExtractor$ForObject",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": 
"org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult"
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": 
"org.apache.shardingsphere.proxy.backend.config.validator.constraint.NoConflictingDataSourceNames",
+      "methods": [
+        {
+          "name": "groups",
+          "parameterTypes": []
+        },
+        {
+          "name": "message",
+          "parameterTypes": []
+        },
+        {
+          "name": "payload",
+          "parameterTypes": []
+        }
+      ]
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "type": 
"org.apache.shardingsphere.proxy.backend.config.validator.constraint.NoConflictingDataSourceNamesValidator",
+      "methods": [
+        {
+          "name": "<init>",
+          "parameterTypes": []
+        }
+      ]
+    },
     {
       "condition": {
         "typeReached": 
"org.apache.shardingsphere.infra.config.rule.validator.RuleConfigurationValidator"
@@ -1545,6 +1740,18 @@
       },
       "glob": "org/apache/bval/jsr/DefaultConstraints.properties"
     },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "glob": "org/apache/bval/jsr/DefaultConstraints.properties"
+    },
+    {
+      "condition": {
+        "typeReached": 
"org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator"
+      },
+      "glob": 
"org/apache/bval/jsr/valueextraction/DefaultExtractors.properties"
+    },
     {
       "condition": {
         "typeReached": 
"org.apache.shardingsphere.infra.spi.RegisteredShardingSphereSPI"
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/YamlProxyConfiguration.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoadResult.java
similarity index 85%
rename from 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/YamlProxyConfiguration.java
rename to 
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoadResult.java
index 8ab671b2b76..f7a95d916bb 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/YamlProxyConfiguration.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoadResult.java
@@ -19,17 +19,19 @@ package org.apache.shardingsphere.proxy.backend.config;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
+import 
org.apache.shardingsphere.proxy.backend.config.validator.constraint.NoConflictingDataSourceNames;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
 
 import java.util.Map;
 
 /**
- * YAML configuration for ShardingSphere-Proxy.
+ * Proxy configuration load result.
  */
 @RequiredArgsConstructor
 @Getter
-public final class YamlProxyConfiguration {
+@NoConflictingDataSourceNames
+public final class ProxyConfigurationLoadResult {
     
     private final YamlProxyServerConfiguration serverConfiguration;
     
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
index aebfd57c4f6..10c00d1a526 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
@@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlGlobalRuleConfiguration;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
 import 
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
-import 
org.apache.shardingsphere.proxy.backend.config.checker.YamlProxyConfigurationChecker;
+import 
org.apache.shardingsphere.proxy.backend.config.validator.ProxyConfigurationLoadResultValidator;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
 
@@ -78,16 +78,17 @@ public final class ProxyConfigurationLoader {
      * Load configuration of ShardingSphere-Proxy.
      *
      * @param path configuration path of ShardingSphere-Proxy
-     * @return configuration of ShardingSphere-Proxy
+     * @return configuration load result of ShardingSphere-Proxy
      * @throws IOException IO exception
      */
-    public static YamlProxyConfiguration load(final String path) throws 
IOException {
+    public static ProxyConfigurationLoadResult load(final String path) throws 
IOException {
         YamlProxyServerConfiguration serverConfig = 
loadServerConfiguration(getGlobalConfigFile(path));
         File configPath = getResourceFile(path);
         Collection<YamlProxyDatabaseConfiguration> databaseConfigs = 
loadDatabaseConfigurations(configPath);
-        
YamlProxyConfigurationChecker.checkDataSources(serverConfig.getDataSources(), 
databaseConfigs);
-        return new YamlProxyConfiguration(serverConfig, 
databaseConfigs.stream().collect(Collectors.toMap(
+        ProxyConfigurationLoadResult result = new 
ProxyConfigurationLoadResult(serverConfig, 
databaseConfigs.stream().collect(Collectors.toMap(
                 YamlProxyDatabaseConfiguration::getDatabaseName, each -> each, 
(oldValue, currentValue) -> oldValue, LinkedHashMap::new)));
+        ProxyConfigurationLoadResultValidator.validate(result);
+        return result;
     }
     
     private static File getGlobalConfigFile(final String path) {
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/checker/YamlProxyConfigurationChecker.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/checker/YamlProxyConfigurationChecker.java
deleted file mode 100644
index 1f413e6c3b5..00000000000
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/checker/YamlProxyConfigurationChecker.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.backend.config.checker;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.exception.ShardingSpherePreconditions;
-import 
org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.DuplicateStorageUnitException;
-import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
-import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * YAML configuration checker for ShardingSphere-Proxy.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class YamlProxyConfigurationChecker {
-    
-    /**
-     * Check data sources.
-     *
-     * @param globalDataSources global data sources
-     * @param databaseConfigs database configurations
-     */
-    public static void checkDataSources(final Map<String, 
YamlProxyDataSourceConfiguration> globalDataSources, final 
Collection<YamlProxyDatabaseConfiguration> databaseConfigs) {
-        databaseConfigs.forEach(each -> checkDataSources(globalDataSources, 
each.getDataSources(), each.getDatabaseName()));
-    }
-    
-    private static void checkDataSources(final Map<String, 
YamlProxyDataSourceConfiguration> globalDataSources,
-                                         final Map<String, 
YamlProxyDataSourceConfiguration> databaseDataSources, final String 
databaseName) {
-        Collection<String> duplicatedDataSourceNames = 
globalDataSources.keySet().stream().filter(databaseDataSources.keySet()::contains).collect(Collectors.toSet());
-        ShardingSpherePreconditions.checkMustEmpty(duplicatedDataSourceNames, 
() -> new DuplicateStorageUnitException(databaseName, 
duplicatedDataSourceNames));
-    }
-}
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/ProxyConfigurationLoadResultValidator.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/ProxyConfigurationLoadResultValidator.java
new file mode 100644
index 00000000000..aea8f7a61c5
--- /dev/null
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/ProxyConfigurationLoadResultValidator.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.config.validator;
+
+import com.google.common.collect.Iterables;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.bval.jsr.ApacheValidationProvider;
+import org.apache.shardingsphere.infra.exception.ShardingSpherePreconditions;
+import 
org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.DuplicateStorageUnitException;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Path;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.stream.Collectors;
+
+/**
+ * Proxy configuration load result validator.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ProxyConfigurationLoadResultValidator {
+    
+    private static final Validator VALIDATOR = 
Validation.byProvider(ApacheValidationProvider.class).configure().buildValidatorFactory().getValidator();
+    
+    /**
+     * Validate proxy configuration load result.
+     *
+     * @param loadResult proxy configuration load result
+     */
+    public static void validate(final ProxyConfigurationLoadResult loadResult) 
{
+        Collection<ConstraintViolation<ProxyConfigurationLoadResult>> 
violations = VALIDATOR.validate(loadResult);
+        ShardingSpherePreconditions.checkMustEmpty(violations, () -> 
createDuplicateStorageUnitException(loadResult, violations));
+    }
+    
+    private static DuplicateStorageUnitException 
createDuplicateStorageUnitException(final ProxyConfigurationLoadResult 
loadResult,
+                                                                               
      final Collection<ConstraintViolation<ProxyConfigurationLoadResult>> 
violations) {
+        Iterator<Path.Node> nodes = 
violations.iterator().next().getPropertyPath().iterator();
+        nodes.next();
+        String databaseName = 
loadResult.getDatabaseConfigurations().get(nodes.next().getKey()).getDatabaseName();
+        return new DuplicateStorageUnitException(databaseName, 
violations.stream().map(each -> (String) 
Iterables.getLast(each.getPropertyPath()).getKey()).collect(Collectors.toSet()));
+    }
+}
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNames.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNames.java
new file mode 100644
index 00000000000..d296d3d4fe6
--- /dev/null
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNames.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.config.validator.constraint;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * No conflicting data source names constraint.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = NoConflictingDataSourceNamesValidator.class)
+@Documented
+public @interface NoConflictingDataSourceNames {
+    
+    /**
+     * Get message.
+     *
+     * @return message
+     */
+    String message() default "must not contain data source names shared by 
global and database configurations";
+    
+    /**
+     * Get groups.
+     *
+     * @return groups
+     */
+    Class<?>[] groups() default {};
+    
+    /**
+     * Get payload.
+     *
+     * @return payload
+     */
+    Class<? extends Payload>[] payload() default {};
+}
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNamesValidator.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNamesValidator.java
new file mode 100644
index 00000000000..b3fd73e49f9
--- /dev/null
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNamesValidator.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.config.validator.constraint;
+
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+
+/**
+ * No conflicting data source names validator.
+ */
+public final class NoConflictingDataSourceNamesValidator implements 
ConstraintValidator<NoConflictingDataSourceNames, ProxyConfigurationLoadResult> 
{
+    
+    @Override
+    public boolean isValid(final ProxyConfigurationLoadResult value, final 
ConstraintValidatorContext context) {
+        Collection<String> globalDataSourceNames = 
value.getServerConfiguration().getDataSources().keySet();
+        for (Entry<String, YamlProxyDatabaseConfiguration> entry : 
value.getDatabaseConfigurations().entrySet()) {
+            Collection<String> duplicatedDataSourceNames = 
globalDataSourceNames.stream().filter(entry.getValue().getDataSources().keySet()::contains).collect(Collectors.toSet());
+            if (!duplicatedDataSourceNames.isEmpty()) {
+                context.disableDefaultConstraintViolation();
+                addViolations(entry.getKey(), duplicatedDataSourceNames, 
context);
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private void addViolations(final String databaseKey, final 
Collection<String> dataSourceNames, final ConstraintValidatorContext context) {
+        for (String each : dataSourceNames) {
+            
context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate())
+                    .addPropertyNode("databaseConfigurations")
+                    .addPropertyNode("dataSources")
+                    .inContainer(Map.class, 1)
+                    .inIterable()
+                    .atKey(databaseKey)
+                    .addBeanNode()
+                    .inContainer(Map.class, 1)
+                    .inIterable()
+                    .atKey(each)
+                    .addConstraintViolation();
+        }
+    }
+}
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
index eb3a592b857..b91d3017f59 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapper.java
@@ -27,8 +27,8 @@ import 
org.apache.shardingsphere.infra.datasource.pool.props.creator.DataSourceP
 import 
org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties;
 import 
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapperEngine;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import org.apache.shardingsphere.proxy.backend.config.ProxyGlobalConfiguration;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
@@ -53,14 +53,14 @@ public final class YamlProxyConfigurationSwapper {
     /**
      * Swap YAML proxy configuration to proxy configuration.
      *
-     * @param yamlConfig YAML proxy configuration
+     * @param loadResult proxy configuration load result
      * @return proxy configuration
      */
-    public ProxyConfiguration swap(final YamlProxyConfiguration yamlConfig) {
+    public ProxyConfiguration swap(final ProxyConfigurationLoadResult 
loadResult) {
         boolean isInstanceConnectionEnabled =
-                (boolean) 
yamlConfig.getServerConfiguration().getProps().getOrDefault(TemporaryConfigurationPropertyKey.INSTANCE_CONNECTION_ENABLED.getKey(),
 Boolean.FALSE);
-        Map<String, DatabaseConfiguration> databaseConfigs = 
swapDatabaseConfigurations(yamlConfig.getDatabaseConfigurations(), 
isInstanceConnectionEnabled);
-        ProxyGlobalConfiguration globalConfig = 
swapGlobalConfiguration(yamlConfig.getServerConfiguration());
+                (boolean) 
loadResult.getServerConfiguration().getProps().getOrDefault(TemporaryConfigurationPropertyKey.INSTANCE_CONNECTION_ENABLED.getKey(),
 Boolean.FALSE);
+        Map<String, DatabaseConfiguration> databaseConfigs = 
swapDatabaseConfigurations(loadResult.getDatabaseConfigurations(), 
isInstanceConnectionEnabled);
+        ProxyGlobalConfiguration globalConfig = 
swapGlobalConfiguration(loadResult.getServerConfiguration());
         return new ProxyConfiguration(databaseConfigs, globalConfig);
     }
     
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
index 31ef0eec2c8..b03c1c0d84c 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoaderTest.java
@@ -21,6 +21,7 @@ import 
org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfigur
 import 
org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
 import 
org.apache.shardingsphere.globalclock.yaml.config.YamlGlobalClockRuleConfiguration;
 import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
+import 
org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.DuplicateStorageUnitException;
 import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
 import 
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
@@ -65,7 +66,7 @@ class ProxyConfigurationLoaderTest {
     
     @Test
     void assertLoadEmptyConfiguration() throws IOException {
-        YamlProxyConfiguration actual = 
ProxyConfigurationLoader.load("/conf/empty/");
+        ProxyConfigurationLoadResult actual = 
ProxyConfigurationLoader.load("/conf/empty/");
         YamlProxyServerConfiguration serverConfig = 
actual.getServerConfiguration();
         assertNull(serverConfig.getMode());
         assertNull(serverConfig.getAuthority());
@@ -76,7 +77,7 @@ class ProxyConfigurationLoaderTest {
     
     @Test
     void assertLoad() throws IOException {
-        YamlProxyConfiguration actual = 
ProxyConfigurationLoader.load("/conf/config_loader/");
+        ProxyConfigurationLoadResult actual = 
ProxyConfigurationLoader.load("/conf/config_loader/");
         Iterator<YamlRuleConfiguration> actualGlobalRules = 
actual.getServerConfiguration().getRules().iterator();
         // TODO assert mode
         // TODO assert authority rule
@@ -113,7 +114,7 @@ class ProxyConfigurationLoaderTest {
                 + "dataSources:\n"
                 + "  ds_0:\n"
                 + "    url: jdbc:mock://127.0.0.1/compatible\n");
-        YamlProxyConfiguration actual = 
ProxyConfigurationLoader.load(tempDir.toString());
+        ProxyConfigurationLoadResult actual = 
ProxyConfigurationLoader.load(tempDir.toString());
         YamlProxyServerConfiguration serverConfig = 
actual.getServerConfiguration();
         assertThat(serverConfig.getRules().size(), is(6));
         Iterator<YamlRuleConfiguration> rules = 
serverConfig.getRules().iterator();
@@ -154,12 +155,20 @@ class ProxyConfigurationLoaderTest {
     @Test
     void assertLoadWithFilesystemPath(@TempDir final Path tempDir) throws 
IOException {
         writeConfigurationFile(tempDir, "global.yaml", "");
-        YamlProxyConfiguration actual = 
ProxyConfigurationLoader.load(tempDir.toString());
+        ProxyConfigurationLoadResult actual = 
ProxyConfigurationLoader.load(tempDir.toString());
         assertNotNull(actual.getServerConfiguration());
         assertTrue(actual.getServerConfiguration().getRules().isEmpty());
         assertTrue(actual.getDatabaseConfigurations().isEmpty());
     }
     
+    @Test
+    void assertLoadWithDuplicateGlobalAndDatabaseDataSource(@TempDir final 
Path tempDir) throws IOException {
+        writeConfigurationFile(tempDir, "global.yaml", "dataSources:\n  
ds_0:\n    url: jdbc:mock://127.0.0.1/global\n");
+        writeConfigurationFile(tempDir, "database-duplicate.yaml", 
"databaseName: foo_db\ndataSources:\n  ds_0:\n    url: 
jdbc:mock://127.0.0.1/local\n");
+        DuplicateStorageUnitException actual = 
assertThrows(DuplicateStorageUnitException.class, () -> 
ProxyConfigurationLoader.load(tempDir.toString()));
+        assertThat(actual.getMessage(), is("Duplicate storage unit names 
'ds_0' on database 'foo_db'."));
+    }
+    
     @Test
     void assertLoadWithHyphenDatabaseName(@TempDir final Path tempDir) throws 
IOException {
         writeConfigurationFile(tempDir, "global.yaml", "");
@@ -175,7 +184,7 @@ class ProxyConfigurationLoaderTest {
                 + "  users:\n"
                 + "    - user: root\n"
                 + "      password: root\n");
-        YamlProxyConfiguration actual = 
ProxyConfigurationLoader.load(tempDir.toString());
+        ProxyConfigurationLoadResult actual = 
ProxyConfigurationLoader.load(tempDir.toString());
         assertNotNull(actual.getServerConfiguration());
         assertFalse(actual.getServerConfiguration().getRules().isEmpty());
         assertTrue(actual.getDatabaseConfigurations().isEmpty());
@@ -183,14 +192,14 @@ class ProxyConfigurationLoaderTest {
     
     @Test
     void assertLoadFromClasspathWhenPathDoesNotExistOnFilesystem() throws 
IOException {
-        YamlProxyConfiguration actual = 
ProxyConfigurationLoader.load("/conf/config_loader/");
+        ProxyConfigurationLoadResult actual = 
ProxyConfigurationLoader.load("/conf/config_loader/");
         assertNotNull(actual.getServerConfiguration());
         assertThat(actual.getDatabaseConfigurations().size(), is(3));
     }
     
     @Test
     void assertLoadFromClasspathWithCompatibleServerYaml() throws IOException {
-        YamlProxyConfiguration actual = 
ProxyConfigurationLoader.load("/conf/compatible_server_yaml/");
+        ProxyConfigurationLoadResult actual = 
ProxyConfigurationLoader.load("/conf/compatible_server_yaml/");
         assertNotNull(actual.getServerConfiguration());
         assertFalse(actual.getServerConfiguration().getRules().isEmpty());
         assertTrue(actual.getDatabaseConfigurations().isEmpty());
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/checker/YamlProxyConfigurationCheckerTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/checker/YamlProxyConfigurationCheckerTest.java
deleted file mode 100644
index 22b859cf413..00000000000
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/checker/YamlProxyConfigurationCheckerTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.backend.config.checker;
-
-import 
org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.DuplicateStorageUnitException;
-import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
-import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collections;
-import java.util.Map;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-class YamlProxyConfigurationCheckerTest {
-    
-    @Test
-    void assertCheckDataSourcesWithoutDuplicates() {
-        Map<String, YamlProxyDataSourceConfiguration> globalDataSources = 
Collections.singletonMap("global_ds", new YamlProxyDataSourceConfiguration());
-        YamlProxyDatabaseConfiguration databaseConfig = new 
YamlProxyDatabaseConfiguration();
-        databaseConfig.setDatabaseName("foo_db");
-        databaseConfig.setDataSources(Collections.singletonMap("db_ds", new 
YamlProxyDataSourceConfiguration()));
-        assertDoesNotThrow(() -> 
YamlProxyConfigurationChecker.checkDataSources(globalDataSources, 
Collections.singleton(databaseConfig)));
-    }
-    
-    @Test
-    void assertCheckDataSourcesWithDuplicates() {
-        Map<String, YamlProxyDataSourceConfiguration> globalDataSources = 
Collections.singletonMap("ds_0", new YamlProxyDataSourceConfiguration());
-        YamlProxyDatabaseConfiguration databaseConfig = new 
YamlProxyDatabaseConfiguration();
-        databaseConfig.setDatabaseName("foo_db");
-        databaseConfig.setDataSources(Collections.singletonMap("ds_0", new 
YamlProxyDataSourceConfiguration()));
-        DuplicateStorageUnitException ex = 
assertThrows(DuplicateStorageUnitException.class,
-                () -> 
YamlProxyConfigurationChecker.checkDataSources(globalDataSources, 
Collections.singleton(databaseConfig)));
-        assertThat(ex.getMessage(), is("Duplicate storage unit names 'ds_0' on 
database 'foo_db'."));
-    }
-}
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/validator/ProxyConfigurationLoadResultValidatorTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/validator/ProxyConfigurationLoadResultValidatorTest.java
new file mode 100644
index 00000000000..7bab6d96812
--- /dev/null
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/validator/ProxyConfigurationLoadResultValidatorTest.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.config.validator;
+
+import 
org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.DuplicateStorageUnitException;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.anyOf;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class ProxyConfigurationLoadResultValidatorTest {
+    
+    @Test
+    void assertValidateWithoutDuplicates() {
+        ProxyConfigurationLoadResult loadResult = createConfig("foo_db", 
"foo_db", Collections.singletonMap("global_ds", new 
YamlProxyDataSourceConfiguration()),
+                Collections.singletonMap("db_ds", new 
YamlProxyDataSourceConfiguration()));
+        assertDoesNotThrow(() -> 
ProxyConfigurationLoadResultValidator.validate(loadResult));
+    }
+    
+    private ProxyConfigurationLoadResult createConfig(final String 
databaseKey, final String databaseName, final Map<String, 
YamlProxyDataSourceConfiguration> globalDataSources,
+                                                      final Map<String, 
YamlProxyDataSourceConfiguration> databaseDataSources) {
+        YamlProxyServerConfiguration serverConfig = new 
YamlProxyServerConfiguration();
+        serverConfig.setDataSources(globalDataSources);
+        YamlProxyDatabaseConfiguration databaseConfig = new 
YamlProxyDatabaseConfiguration();
+        databaseConfig.setDatabaseName(databaseName);
+        databaseConfig.setDataSources(databaseDataSources);
+        return new ProxyConfigurationLoadResult(serverConfig, 
Collections.singletonMap(databaseKey, databaseConfig));
+    }
+    
+    @ParameterizedTest(name = "{0}")
+    @MethodSource("duplicateDataSourceArguments")
+    void assertValidateWithDuplicateDataSource(final String name, final String 
databaseKey, final String databaseName, final String dataSourceName, final 
String expectedMessage) {
+        Map<String, YamlProxyDataSourceConfiguration> dataSources = 
Collections.singletonMap(dataSourceName, new 
YamlProxyDataSourceConfiguration());
+        ProxyConfigurationLoadResult loadResult = createConfig(databaseKey, 
databaseName, dataSources, dataSources);
+        DuplicateStorageUnitException actual = 
assertThrows(DuplicateStorageUnitException.class, () -> 
ProxyConfigurationLoadResultValidator.validate(loadResult));
+        assertThat(actual.getMessage(), is(expectedMessage));
+        SQLException actualSQLException = actual.toSQLException();
+        assertThat(actualSQLException.getMessage(), is(expectedMessage));
+        assertThat(actualSQLException.getSQLState(), is("42S01"));
+        assertThat(actualSQLException.getErrorCode(), is(10104));
+    }
+    
+    private static Stream<Arguments> duplicateDataSourceArguments() {
+        return Stream.of(
+                Arguments.of("same database key and name", "foo_db", "foo_db", 
"ds_0", "Duplicate storage unit names 'ds_0' on database 'foo_db'."),
+                Arguments.of("different database key and name", "map_key", 
"configured_db", "ds_0", "Duplicate storage unit names 'ds_0' on database 
'configured_db'."),
+                Arguments.of("special characters in map keys", 
"db.[key]{value}${suffix}\\key", "foo_db", "ds.[0]{value}${suffix}\\name",
+                        "Duplicate storage unit names 
'ds.[0]{value}${suffix}\\name' on database 'foo_db'."));
+    }
+    
+    @Test
+    void assertValidateWithMultipleDuplicateDataSources() {
+        Map<String, YamlProxyDataSourceConfiguration> dataSources = new 
HashMap<>(2, 1F);
+        dataSources.put("ds_0", new YamlProxyDataSourceConfiguration());
+        dataSources.put("ds_1", new YamlProxyDataSourceConfiguration());
+        ProxyConfigurationLoadResult loadResult = createConfig("foo_db", 
"foo_db", dataSources, dataSources);
+        DuplicateStorageUnitException actual = 
assertThrows(DuplicateStorageUnitException.class, () -> 
ProxyConfigurationLoadResultValidator.validate(loadResult));
+        assertThat(actual.getMessage(), anyOf(is("Duplicate storage unit names 
'ds_0, ds_1' on database 'foo_db'."), is("Duplicate storage unit names 'ds_1, 
ds_0' on database 'foo_db'.")));
+        SQLException actualSQLException = actual.toSQLException();
+        assertThat(actualSQLException.getMessage(), is(actual.getMessage()));
+        assertThat(actualSQLException.getSQLState(), is("42S01"));
+        assertThat(actualSQLException.getErrorCode(), is(10104));
+    }
+}
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNamesValidatorTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNamesValidatorTest.java
new file mode 100644
index 00000000000..bf0d592dbea
--- /dev/null
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/validator/constraint/NoConflictingDataSourceNamesValidatorTest.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.config.validator.constraint;
+
+import org.apache.bval.jsr.ApacheValidationProvider;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.ConstraintViolation;
+import javax.validation.ElementKind;
+import javax.validation.Path;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoInteractions;
+
+class NoConflictingDataSourceNamesValidatorTest {
+    
+    private static final Validator VALIDATOR = 
Validation.byProvider(ApacheValidationProvider.class).configure().buildValidatorFactory().getValidator();
+    
+    private final NoConflictingDataSourceNamesValidator validator = new 
NoConflictingDataSourceNamesValidator();
+    
+    @ParameterizedTest(name = "{0}")
+    @MethodSource("validConfigsArguments")
+    void assertIsValidWithoutConflicts(final String name, final 
ProxyConfigurationLoadResult config) {
+        ConstraintValidatorContext context = 
mock(ConstraintValidatorContext.class);
+        assertTrue(validator.isValid(config, context));
+        verifyNoInteractions(context);
+    }
+    
+    private static Stream<Arguments> validConfigsArguments() {
+        Map<String, Collection<String>> sharedLocalNames = new 
LinkedHashMap<>(2, 1F);
+        sharedLocalNames.put("foo_db", Collections.singleton("foo_ds"));
+        sharedLocalNames.put("bar_db", Collections.singleton("foo_ds"));
+        return Stream.of(
+                Arguments.of("No databases", 
createConfig(Collections.singleton("foo_ds"), Collections.emptyMap())),
+                Arguments.of("No global sources", 
createConfig(Collections.emptyList(), Collections.singletonMap("foo_db", 
Collections.singleton("foo_ds")))),
+                Arguments.of("No database sources", 
createConfig(Collections.singleton("foo_ds"), 
Collections.singletonMap("foo_db", Collections.emptyList()))),
+                Arguments.of("Distinct names", 
createConfig(Collections.singleton("foo_ds"), 
Collections.singletonMap("foo_db", Collections.singleton("bar_ds")))),
+                Arguments.of("Case-sensitive names", 
createConfig(Collections.singleton("foo_ds"), 
Collections.singletonMap("foo_db", Collections.singleton("FOO_DS")))),
+                Arguments.of("Same local names across databases", 
createConfig(Collections.singleton("global_ds"), sharedLocalNames)));
+    }
+    
+    private static ProxyConfigurationLoadResult createConfig(final 
Collection<String> globalDataSourceNames, final Map<String, Collection<String>> 
databaseDataSourceNames) {
+        YamlProxyServerConfiguration serverConfig = new 
YamlProxyServerConfiguration();
+        serverConfig.setDataSources(createDataSources(globalDataSourceNames));
+        Map<String, YamlProxyDatabaseConfiguration> databaseConfigs = new 
LinkedHashMap<>(databaseDataSourceNames.size(), 1F);
+        for (Entry<String, Collection<String>> entry : 
databaseDataSourceNames.entrySet()) {
+            YamlProxyDatabaseConfiguration databaseConfig = new 
YamlProxyDatabaseConfiguration();
+            databaseConfig.setDatabaseName(entry.getKey());
+            databaseConfig.setDataSources(createDataSources(entry.getValue()));
+            databaseConfigs.put(entry.getKey(), databaseConfig);
+        }
+        return new ProxyConfigurationLoadResult(serverConfig, databaseConfigs);
+    }
+    
+    private static Map<String, YamlProxyDataSourceConfiguration> 
createDataSources(final Collection<String> dataSourceNames) {
+        Map<String, YamlProxyDataSourceConfiguration> result = new 
HashMap<>(dataSourceNames.size(), 1F);
+        for (String each : dataSourceNames) {
+            result.put(each, new YamlProxyDataSourceConfiguration());
+        }
+        return result;
+    }
+    
+    @ParameterizedTest(name = "{0}")
+    @MethodSource("conflictingConfigsArguments")
+    void assertIsValidWithConflicts(final String name, final 
ProxyConfigurationLoadResult config, final String expectedDatabaseKey, final 
Collection<String> expectedDataSourceNames) {
+        Collection<ConstraintViolation<ProxyConfigurationLoadResult>> actual = 
VALIDATOR.validate(config);
+        assertThat(actual.size(), is(expectedDataSourceNames.size()));
+        Collection<String> actualDataSourceNames = new 
ArrayList<>(actual.size());
+        for (ConstraintViolation<ProxyConfigurationLoadResult> each : actual) {
+            List<Path.Node> actualPath = 
StreamSupport.stream(each.getPropertyPath().spliterator(), 
false).collect(Collectors.toList());
+            assertThat(actualPath.size(), is(3));
+            assertThat(actualPath.get(0).getName(), 
is("databaseConfigurations"));
+            assertThat(actualPath.get(1).getName(), is("dataSources"));
+            assertThat(actualPath.get(1).getKey(), is(expectedDatabaseKey));
+            assertThat(actualPath.get(2).getKind(), is(ElementKind.BEAN));
+            actualDataSourceNames.add((String) actualPath.get(2).getKey());
+            assertThat(each.getMessage(), is("must not contain data source 
names shared by global and database configurations"));
+        }
+        assertThat(actualDataSourceNames, 
containsInAnyOrder(expectedDataSourceNames.toArray(new String[0])));
+    }
+    
+    private static Stream<Arguments> conflictingConfigsArguments() {
+        Map<String, Collection<String>> multipleDatabases = new 
LinkedHashMap<>(3, 1F);
+        multipleDatabases.put("foo_db", Collections.singleton("other_ds"));
+        multipleDatabases.put("bar_db", Arrays.asList("foo_ds", "bar_ds"));
+        multipleDatabases.put("baz_db", Collections.singleton("baz_ds"));
+        String specialDataSourceName = "${validatedValue}[foo].{bar}";
+        return Stream.of(
+                Arguments.of("One conflicting source", 
createConfig(Collections.singleton("foo_ds"), 
Collections.singletonMap("foo_db", Collections.singleton("foo_ds"))),
+                        "foo_db", Collections.singleton("foo_ds")),
+                Arguments.of("First conflicting database and all its sources", 
createConfig(Arrays.asList("foo_ds", "bar_ds", "baz_ds"), multipleDatabases), 
"bar_db",
+                        Arrays.asList("foo_ds", "bar_ds")),
+                Arguments.of("Special source key", 
createConfig(Collections.singleton(specialDataSourceName), 
Collections.singletonMap("foo_db", 
Collections.singleton(specialDataSourceName))),
+                        "foo_db", 
Collections.singleton(specialDataSourceName)));
+    }
+}
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
index b8dbbc3281e..17c65123a6f 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
@@ -24,8 +24,8 @@ import 
org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
 import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
 import 
org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
 import 
org.apache.shardingsphere.readwritesplitting.config.ReadwriteSplittingRuleConfiguration;
 import 
org.apache.shardingsphere.readwritesplitting.config.rule.ReadwriteSplittingDataSourceGroupRuleConfiguration;
 import org.junit.jupiter.api.Test;
@@ -45,8 +45,8 @@ class YamlProxyConfigurationSwapperTest {
     
     @Test
     void assertSwap() throws IOException {
-        YamlProxyConfiguration yamlProxyConfig = 
ProxyConfigurationLoader.load("/conf/swap");
-        ProxyConfiguration actual = new 
YamlProxyConfigurationSwapper().swap(yamlProxyConfig);
+        ProxyConfigurationLoadResult loadResult = 
ProxyConfigurationLoader.load("/conf/swap");
+        ProxyConfiguration actual = new 
YamlProxyConfigurationSwapper().swap(loadResult);
         assertDataSources(actual);
         assertDatabaseRules(actual);
         assertAuthorityRuleConfiguration(actual);
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java
index ebf2d359486..2202edd9f2c 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapperTest.java
@@ -20,8 +20,8 @@ package 
org.apache.shardingsphere.proxy.backend.config.yaml.swapper;
 import 
org.apache.shardingsphere.infra.datasource.pool.config.ConnectionConfiguration;
 import 
org.apache.shardingsphere.infra.datasource.pool.config.DataSourceConfiguration;
 import 
org.apache.shardingsphere.infra.datasource.pool.config.PoolConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDataSourceConfiguration;
 import org.junit.jupiter.api.Test;
 
@@ -36,8 +36,8 @@ class YamlProxyDataSourceConfigurationSwapperTest {
     
     @Test
     void assertSwap() throws IOException {
-        YamlProxyConfiguration yamlProxyConfig = 
ProxyConfigurationLoader.load("/conf/swap");
-        YamlProxyDataSourceConfiguration yamlProxyDataSourceConfig = 
yamlProxyConfig.getDatabaseConfigurations().get("swapper_test").getDataSources().get("foo_db");
+        ProxyConfigurationLoadResult loadResult = 
ProxyConfigurationLoader.load("/conf/swap");
+        YamlProxyDataSourceConfiguration yamlProxyDataSourceConfig = 
loadResult.getDatabaseConfigurations().get("swapper_test").getDataSources().get("foo_db");
         DataSourceConfiguration actualDataSourceConfig = new 
YamlProxyDataSourceConfigurationSwapper().swap(yamlProxyDataSourceConfig);
         assertConnectionConfig(actualDataSourceConfig);
         assertPoolConfig(actualDataSourceConfig);
diff --git 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
index 63b802276b4..6e789e6176b 100644
--- 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
+++ 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
@@ -22,8 +22,8 @@ import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.proxy.arguments.BootstrapArguments;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
 import org.apache.shardingsphere.proxy.frontend.CDCServer;
 import org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
@@ -57,12 +57,12 @@ public final class Bootstrap {
      */
     public static void main(final String[] args) throws IOException, 
SQLException {
         BootstrapArguments bootstrapArgs = new BootstrapArguments(args);
-        YamlProxyConfiguration yamlConfig = 
ProxyConfigurationLoader.load(bootstrapArgs.getConfigurationPath());
-        int port = bootstrapArgs.getPort().orElseGet(() -> new 
ConfigurationProperties(yamlConfig.getServerConfiguration().getProps()).getValue(ConfigurationPropertyKey.PROXY_DEFAULT_PORT));
+        ProxyConfigurationLoadResult loadResult = 
ProxyConfigurationLoader.load(bootstrapArgs.getConfigurationPath());
+        int port = bootstrapArgs.getPort().orElseGet(() -> new 
ConfigurationProperties(loadResult.getServerConfiguration().getProps()).getValue(ConfigurationPropertyKey.PROXY_DEFAULT_PORT));
         List<String> addresses = bootstrapArgs.getAddresses();
         checkPort(addresses, port);
-        new BootstrapInitializer().init(yamlConfig, port);
-        Optional.ofNullable((Integer) 
yamlConfig.getServerConfiguration().getProps().get(ConfigurationPropertyKey.CDC_SERVER_PORT.getKey()))
+        new BootstrapInitializer().init(loadResult, port);
+        Optional.ofNullable((Integer) 
loadResult.getServerConfiguration().getProps().get(ConfigurationPropertyKey.CDC_SERVER_PORT.getKey()))
                 .ifPresent(optional -> new Thread(new CDCServer(addresses, 
optional)).start());
         ProxySSLContext.init();
         ShardingSphereProxy proxy = new ShardingSphereProxy();
diff --git 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
index a966ec2e974..b0e4ea41f7d 100644
--- 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
+++ 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.manager.builder.ContextManagerBuilder;
 import 
org.apache.shardingsphere.mode.manager.builder.ContextManagerBuilderParameter;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfiguration;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper;
 import org.apache.shardingsphere.proxy.backend.context.BackendExecutorContext;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -43,13 +43,13 @@ public final class BootstrapInitializer {
     /**
      * Initialize.
      *
-     * @param yamlConfig YAML proxy configuration
+     * @param loadResult proxy configuration load result
      * @param port proxy port
      * @throws SQLException SQL exception
      */
-    public void init(final YamlProxyConfiguration yamlConfig, final int port) 
throws SQLException {
-        ModeConfiguration modeConfig = null == 
yamlConfig.getServerConfiguration().getMode() ? null : new 
YamlModeConfigurationSwapper().swapToObject(yamlConfig.getServerConfiguration().getMode());
-        ProxyConfiguration proxyConfig = new 
YamlProxyConfigurationSwapper().swap(yamlConfig);
+    public void init(final ProxyConfigurationLoadResult loadResult, final int 
port) throws SQLException {
+        ModeConfiguration modeConfig = null == 
loadResult.getServerConfiguration().getMode() ? null : new 
YamlModeConfigurationSwapper().swapToObject(loadResult.getServerConfiguration().getMode());
+        ProxyConfiguration proxyConfig = new 
YamlProxyConfigurationSwapper().swap(loadResult);
         ContextManager contextManager = createContextManager(proxyConfig, 
modeConfig, port);
         ProxyContext.init(contextManager);
         BackendExecutorContext.getInstance().init();
diff --git 
a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
 
b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
index fed04ab153a..a84fb448056 100644
--- 
a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
+++ 
b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
@@ -26,7 +26,7 @@ import 
org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
 import org.apache.shardingsphere.mode.manager.builder.ContextManagerBuilder;
 import 
org.apache.shardingsphere.mode.manager.builder.ContextManagerBuilderParameter;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyDatabaseConfiguration;
 import 
org.apache.shardingsphere.proxy.backend.config.yaml.YamlProxyServerConfiguration;
 import org.apache.shardingsphere.proxy.backend.context.BackendExecutorContext;
@@ -89,7 +89,7 @@ class BootstrapInitializerTest {
         when(instanceMetaDataBuilder.build(3307, 
"")).thenReturn(instanceMetaData);
         when(contextManagerBuilder.isDefault()).thenReturn(true);
         registerSingletonService(ContextManagerBuilder.class, 
contextManagerBuilder);
-        new BootstrapInitializer().init(createYamlProxyConfiguration(null), 
3307);
+        new 
BootstrapInitializer().init(createProxyConfigurationLoadResult(null), 3307);
         ArgumentCaptor<ContextManagerBuilderParameter> paramCaptor = 
ArgumentCaptor.forClass(ContextManagerBuilderParameter.class);
         verify(instanceMetaDataBuilder).build(3307, "");
         verify(contextManagerBuilder).build(paramCaptor.capture(), 
any(EventBusContext.class));
@@ -116,8 +116,8 @@ class BootstrapInitializerTest {
         when(instanceMetaDataBuilder.build(3307, 
"")).thenReturn(instanceMetaData);
         when(contextManagerBuilder.getType()).thenReturn("Cluster");
         registerSingletonService(ContextManagerBuilder.class, 
contextManagerBuilder);
-        YamlProxyConfiguration yamlConfig = 
createYamlProxyConfiguration(yamlModeConfig);
-        new BootstrapInitializer().init(yamlConfig, 3307);
+        ProxyConfigurationLoadResult loadResult = 
createProxyConfigurationLoadResult(yamlModeConfig);
+        new BootstrapInitializer().init(loadResult, 3307);
         ArgumentCaptor<ContextManagerBuilderParameter> paramCaptor = 
ArgumentCaptor.forClass(ContextManagerBuilderParameter.class);
         verify(instanceMetaDataBuilder).build(3307, "");
         verify(contextManagerBuilder).build(paramCaptor.capture(), 
any(EventBusContext.class));
@@ -142,18 +142,18 @@ class BootstrapInitializerTest {
         when(contextManagerBuilder.isDefault()).thenReturn(true);
         registerSingletonService(ContextManagerBuilder.class, 
contextManagerBuilder);
         BootstrapInitializer bootstrapInitializer = new BootstrapInitializer();
-        bootstrapInitializer.init(createYamlProxyConfiguration(null), 3307);
+        bootstrapInitializer.init(createProxyConfigurationLoadResult(null), 
3307);
         BackendExecutorContext.getInstance().shutdown();
-        bootstrapInitializer.init(createYamlProxyConfiguration(null), 3307);
+        bootstrapInitializer.init(createProxyConfigurationLoadResult(null), 
3307);
         verify(BackendExecutorContext.getInstance(), times(2)).init();
     }
     
-    private YamlProxyConfiguration createYamlProxyConfiguration(final 
YamlModeConfiguration modeConfig) {
+    private ProxyConfigurationLoadResult 
createProxyConfigurationLoadResult(final YamlModeConfiguration modeConfig) {
         YamlProxyServerConfiguration serverConfig = new 
YamlProxyServerConfiguration();
         serverConfig.setMode(modeConfig);
         YamlProxyDatabaseConfiguration databaseConfig = new 
YamlProxyDatabaseConfiguration();
         databaseConfig.setDatabaseName("logic_db");
-        return new YamlProxyConfiguration(serverConfig, 
Collections.singletonMap("logic_db", databaseConfig));
+        return new ProxyConfigurationLoadResult(serverConfig, 
Collections.singletonMap("logic_db", databaseConfig));
     }
     
     @SuppressWarnings("unchecked")
diff --git 
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
 
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
index b44226dcbad..1ac463d74bb 100644
--- 
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
+++ 
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
@@ -28,8 +28,8 @@ import org.apache.commons.lang3.SystemUtils;
 import 
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
 import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
@@ -130,8 +130,8 @@ public final class ShardingSphereProxyEmbeddedContainer 
implements EmbeddedE2ECo
     @SneakyThrows({SQLException.class, IOException.class, 
InterruptedException.class})
     private void startProxy() {
         Path tempConfigurationDirectory = getTempConfigurationDirectory();
-        YamlProxyConfiguration yamlConfig = 
ProxyConfigurationLoader.load(tempConfigurationDirectory.toString());
-        new BootstrapInitializer().init(yamlConfig, proxyPort);
+        ProxyConfigurationLoadResult loadResult = 
ProxyConfigurationLoader.load(tempConfigurationDirectory.toString());
+        new BootstrapInitializer().init(loadResult, proxyPort);
         ProxySSLContext.init();
         proxy = new ShardingSphereProxy();
         List<ChannelFuture> channelFutures = proxy.startInternal(proxyPort, 
Collections.singletonList("0.0.0.0"));
diff --git 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/util/ProxyTestingServer.java
 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/util/ProxyTestingServer.java
index 312dea72b55..040d275dc69 100644
--- 
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/util/ProxyTestingServer.java
+++ 
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/util/ProxyTestingServer.java
@@ -21,8 +21,8 @@ import lombok.Getter;
 import org.apache.curator.test.InstanceSpec;
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.proxy.arguments.BootstrapArguments;
+import 
org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoadResult;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader;
-import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
 import org.apache.shardingsphere.proxy.frontend.CDCServer;
 import org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy;
 import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
@@ -60,12 +60,12 @@ public final class ProxyTestingServer {
         String[] args = new String[]{String.valueOf(proxyPort), 
configAbsolutePath, "0.0.0.0"};
         try {
             BootstrapArguments bootstrapArgs = new BootstrapArguments(args);
-            YamlProxyConfiguration yamlConfig = 
ProxyConfigurationLoader.load(bootstrapArgs.getConfigurationPath());
+            ProxyConfigurationLoadResult loadResult = 
ProxyConfigurationLoader.load(bootstrapArgs.getConfigurationPath());
             int port = bootstrapArgs.getPort().orElseThrow(() -> new 
IllegalStateException("Check 
`org.apache.curator.test.InstanceSpec#getRandomPort`."));
             List<String> addresses = bootstrapArgs.getAddresses();
             checkPort(addresses, port);
-            new BootstrapInitializer().init(yamlConfig, port);
-            Optional.ofNullable((Integer) 
yamlConfig.getServerConfiguration().getProps().get(ConfigurationPropertyKey.CDC_SERVER_PORT.getKey()))
+            new BootstrapInitializer().init(loadResult, port);
+            Optional.ofNullable((Integer) 
loadResult.getServerConfiguration().getProps().get(ConfigurationPropertyKey.CDC_SERVER_PORT.getKey()))
                     .ifPresent(optional -> new Thread(new CDCServer(addresses, 
optional)).start());
             ProxySSLContext.init();
             proxy = new ShardingSphereProxy();

Reply via email to