You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/05/28 13:25:26 UTC

[shardingsphere] branch master updated: Use SPI for RuleConfigurationChecker and split impl to feature modules (#10535)

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

wuweijie 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 e4ddb09  Use SPI for RuleConfigurationChecker and split impl to feature modules (#10535)
e4ddb09 is described below

commit e4ddb09bcb746baa312030164e13938d3339034c
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri May 28 21:24:45 2021 +0800

    Use SPI for RuleConfigurationChecker and split impl to feature modules (#10535)
    
    * Update java doc
    
    * Remove RuleConfigurationCheckerFactoryTest
    
    * Update RuleConfigurationCheckerFactory
    
    * Format code
    
    * Use SPI style for RuleConfigurationChecker
    
    * Split RuleConfigurationChecker impl to feature modules
    
    * Fix test cases
---
 .../DatabaseDiscoveryRuleConfigurationChecker.java | 19 ++++--
 ...ere.infra.rule.checker.RuleConfigurationChecker | 18 +++++
 .../AbstractEncryptRuleConfigurationChecker.java   |  8 +--
 ...thmProvidedEncryptRuleConfigurationChecker.java | 17 ++++-
 .../checker}/EncryptRuleConfigurationChecker.java  | 17 ++++-
 ...ere.infra.rule.checker.RuleConfigurationChecker | 19 ++++++
 ...ReadwriteSplittingRuleConfigurationChecker.java |  9 ++-
 ...ReadwriteSplittingRuleConfigurationChecker.java | 17 ++++-
 ...ReadwriteSplittingRuleConfigurationChecker.java | 17 ++++-
 ...ere.infra.rule.checker.RuleConfigurationChecker | 19 ++++++
 .../checker}/ShadowRuleConfigurationChecker.java   | 19 ++++--
 ...ere.infra.rule.checker.RuleConfigurationChecker | 18 +++++
 .../AbstractShardingRuleConfigurationChecker.java  |  8 +--
 ...hmProvidedShardingRuleConfigurationChecker.java | 18 +++--
 .../checker}/ShardingRuleConfigurationChecker.java | 18 +++--
 ...ere.infra.rule.checker.RuleConfigurationChecker | 19 ++++++
 .../checker/RuleConfigurationCheckerFactory.java   | 70 -------------------
 .../config/impl/SchemaRuleRegistryService.java     | 12 ++--
 .../impl/RuleConfigurationCheckerFactoryTest.java  | 78 ----------------------
 .../rule}/checker/RuleConfigurationChecker.java    | 11 +--
 .../checker/RuleConfigurationCheckerFactory.java   | 52 +++++++++++++++
 ...ernanceShardingSphereDataSourceFactoryTest.java |  8 +--
 .../governance/fixture/TestRuleConfiguration.java  | 17 +----
 .../fixture/TestRuleConfigurationChecker.java      | 31 ++++-----
 ...ere.infra.rule.checker.RuleConfigurationChecker | 18 +++++
 25 files changed, 321 insertions(+), 236 deletions(-)

diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/DatabaseDiscoveryRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-common/src/main/java/org/apache/shardingsphere/dbdiscovery/common/rule/checker/DatabaseDiscoveryRuleConfigurationChecker.java
similarity index 70%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/DatabaseDiscoveryRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-common/src/main/java/org/apache/shardingsphere/dbdiscovery/common/rule/checker/DatabaseDiscoveryRuleConfigurationChecker.java
index bc2450d..eb7ad00 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/DatabaseDiscoveryRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-common/src/main/java/org/apache/shardingsphere/dbdiscovery/common/rule/checker/DatabaseDiscoveryRuleConfigurationChecker.java
@@ -15,11 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.dbdiscovery.common.rule.checker;
 
 import com.google.common.base.Preconditions;
 import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationChecker;
+import org.apache.shardingsphere.dbdiscovery.common.constant.DatabaseDiscoveryOrder;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
 
 /**
  * Database discovery rule configuration checker.
@@ -27,8 +28,18 @@ import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurat
 public final class DatabaseDiscoveryRuleConfigurationChecker implements RuleConfigurationChecker<DatabaseDiscoveryRuleConfiguration> {
     
     @Override
-    public void check(final String schemaName, final DatabaseDiscoveryRuleConfiguration ruleConfiguration) {
-        ruleConfiguration.getDataSources().forEach(each -> Preconditions.checkState(
+    public void check(final String schemaName, final DatabaseDiscoveryRuleConfiguration config) {
+        config.getDataSources().forEach(each -> Preconditions.checkState(
                 !each.getDiscoveryTypeName().isEmpty(), "No available DatabaseDiscovery rule configuration in `%s` for governance.", schemaName));
     }
+    
+    @Override
+    public int getOrder() {
+        return DatabaseDiscoveryOrder.ORDER;
+    }
+    
+    @Override
+    public Class<DatabaseDiscoveryRuleConfiguration> getTypeClass() {
+        return DatabaseDiscoveryRuleConfiguration.class;
+    }
 }
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
new file mode 100644
index 0000000..36993dc
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.dbdiscovery.common.rule.checker.DatabaseDiscoveryRuleConfigurationChecker
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractEncryptRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/AbstractEncryptRuleConfigurationChecker.java
similarity index 78%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractEncryptRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/AbstractEncryptRuleConfigurationChecker.java
index 9929c23..8ba9a59 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractEncryptRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/AbstractEncryptRuleConfigurationChecker.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.encrypt.rule.checker;
 
 import org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncryptRuleConfiguration;
 import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationChecker;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 
 /**
@@ -29,11 +29,11 @@ import org.apache.shardingsphere.infra.config.RuleConfiguration;
  */
 public abstract class AbstractEncryptRuleConfigurationChecker<T extends RuleConfiguration> implements RuleConfigurationChecker<T> {
     
-    protected boolean checkEncryptorsNotEmpty(final EncryptRuleConfiguration ruleConfiguration) {
+    protected final boolean checkEncryptorsNotEmpty(final EncryptRuleConfiguration ruleConfiguration) {
         return !ruleConfiguration.getEncryptors().isEmpty();
     }
     
-    protected boolean checkEncryptorsNotEmpty(final AlgorithmProvidedEncryptRuleConfiguration ruleConfiguration) {
+    protected final boolean checkEncryptorsNotEmpty(final AlgorithmProvidedEncryptRuleConfiguration ruleConfiguration) {
         return !ruleConfiguration.getEncryptors().isEmpty();
     }
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedEncryptRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/AlgorithmProvidedEncryptRuleConfigurationChecker.java
similarity index 68%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedEncryptRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/AlgorithmProvidedEncryptRuleConfigurationChecker.java
index f4fbc16..9473fbc 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedEncryptRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/AlgorithmProvidedEncryptRuleConfigurationChecker.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.encrypt.rule.checker;
 
 import com.google.common.base.Preconditions;
 import org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncryptRuleConfiguration;
+import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
 
 /**
  * Algorithm provided encrypt rule configuration checker.
@@ -26,7 +27,17 @@ import org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncry
 public final class AlgorithmProvidedEncryptRuleConfigurationChecker extends AbstractEncryptRuleConfigurationChecker<AlgorithmProvidedEncryptRuleConfiguration> {
     
     @Override
-    public void check(final String schemaName, final AlgorithmProvidedEncryptRuleConfiguration ruleConfiguration) {
-        Preconditions.checkState(checkEncryptorsNotEmpty(ruleConfiguration), "No available encrypt rule configuration in `%s` for governance.", schemaName);
+    public void check(final String schemaName, final AlgorithmProvidedEncryptRuleConfiguration config) {
+        Preconditions.checkState(checkEncryptorsNotEmpty(config), "No available encrypt rule configuration in `%s` for governance.", schemaName);
+    }
+    
+    @Override
+    public int getOrder() {
+        return EncryptOrder.ALGORITHM_PROVIDER_ENCRYPT_ORDER;
+    }
+    
+    @Override
+    public Class<AlgorithmProvidedEncryptRuleConfiguration> getTypeClass() {
+        return AlgorithmProvidedEncryptRuleConfiguration.class;
     }
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/EncryptRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/EncryptRuleConfigurationChecker.java
similarity index 70%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/EncryptRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/EncryptRuleConfigurationChecker.java
index 8c2aae5..12d1b85 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/EncryptRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/rule/checker/EncryptRuleConfigurationChecker.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.encrypt.rule.checker;
 
 import com.google.common.base.Preconditions;
 import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
+import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
 
 /**
  * Encrypt rule configuration checker.
@@ -26,7 +27,17 @@ import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
 public final class EncryptRuleConfigurationChecker extends AbstractEncryptRuleConfigurationChecker<EncryptRuleConfiguration> {
     
     @Override
-    public void check(final String schemaName, final EncryptRuleConfiguration ruleConfiguration) {
-        Preconditions.checkState(checkEncryptorsNotEmpty(ruleConfiguration), "No available encrypt rule configuration in `%s` for governance.", schemaName);
+    public void check(final String schemaName, final EncryptRuleConfiguration config) {
+        Preconditions.checkState(checkEncryptorsNotEmpty(config), "No available encrypt rule configuration in `%s` for governance.", schemaName);
+    }
+    
+    @Override
+    public int getOrder() {
+        return EncryptOrder.ORDER;
+    }
+    
+    @Override
+    public Class<EncryptRuleConfiguration> getTypeClass() {
+        return EncryptRuleConfiguration.class;
     }
 }
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
new file mode 100644
index 0000000..ff13eae
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.encrypt.rule.checker.EncryptRuleConfigurationChecker
+org.apache.shardingsphere.encrypt.rule.checker.AlgorithmProvidedEncryptRuleConfigurationChecker
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractReadwriteSplittingRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/AbstractReadwriteSplittingRuleConfigurationChecker.java
similarity index 74%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractReadwriteSplittingRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/AbstractReadwriteSplittingRuleConfigurationChecker.java
index 0351a3e..f0b17a7 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractReadwriteSplittingRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/AbstractReadwriteSplittingRuleConfigurationChecker.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.readwritesplitting.common.rule.checker;
 
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationChecker;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration;
 
@@ -32,11 +32,10 @@ import java.util.Collection;
  */
 public abstract class AbstractReadwriteSplittingRuleConfigurationChecker<T extends RuleConfiguration> implements RuleConfigurationChecker<T> {
     
-    protected void checkDataSources(final String schemaName, final Collection<ReadwriteSplittingDataSourceRuleConfiguration> dataSources) {
+    protected final void checkDataSources(final String schemaName, final Collection<ReadwriteSplittingDataSourceRuleConfiguration> dataSources) {
         dataSources.forEach(each -> {
             if (Strings.isNullOrEmpty(each.getAutoAwareDataSourceName())) {
-                Preconditions.checkState(
-                        !each.getWriteDataSourceName().isEmpty(), "No available readwrite-splitting rule configuration in `%s` for governance.", schemaName);
+                Preconditions.checkState(!each.getWriteDataSourceName().isEmpty(), "No available readwrite-splitting rule configuration in `%s` for governance.", schemaName);
             }
         });
     }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.java
similarity index 68%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.java
index f82ca0b..6741055 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.readwritesplitting.common.rule.checker;
 
 import org.apache.shardingsphere.readwritesplitting.common.algorithm.config.AlgorithmProvidedReadwriteSplittingRuleConfiguration;
+import org.apache.shardingsphere.readwritesplitting.common.constant.ReadwriteSplittingOrder;
 
 /**
  * Algorithm provided readwrite-splitting ruleConfiguration checker.
@@ -25,7 +26,17 @@ import org.apache.shardingsphere.readwritesplitting.common.algorithm.config.Algo
 public final class AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker extends AbstractReadwriteSplittingRuleConfigurationChecker<AlgorithmProvidedReadwriteSplittingRuleConfiguration> { 
     
     @Override
-    public void check(final String schemaName, final AlgorithmProvidedReadwriteSplittingRuleConfiguration ruleConfiguration) {
-        checkDataSources(schemaName, ruleConfiguration.getDataSources());
+    public void check(final String schemaName, final AlgorithmProvidedReadwriteSplittingRuleConfiguration config) {
+        checkDataSources(schemaName, config.getDataSources());
+    }
+    
+    @Override
+    public int getOrder() {
+        return ReadwriteSplittingOrder.ALGORITHM_PROVIDER_ORDER;
+    }
+    
+    @Override
+    public Class<AlgorithmProvidedReadwriteSplittingRuleConfiguration> getTypeClass() {
+        return AlgorithmProvidedReadwriteSplittingRuleConfiguration.class;
     }
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ReadwriteSplittingRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/ReadwriteSplittingRuleConfigurationChecker.java
similarity index 69%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ReadwriteSplittingRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/ReadwriteSplittingRuleConfigurationChecker.java
index 876a059..9973c39 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ReadwriteSplittingRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/java/org/apache/shardingsphere/readwritesplitting/common/rule/checker/ReadwriteSplittingRuleConfigurationChecker.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.readwritesplitting.common.rule.checker;
 
 import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
+import org.apache.shardingsphere.readwritesplitting.common.constant.ReadwriteSplittingOrder;
 
 /**
  * Readwrite-splitting rule configuration checker.
@@ -25,7 +26,17 @@ import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleCo
 public final class ReadwriteSplittingRuleConfigurationChecker extends AbstractReadwriteSplittingRuleConfigurationChecker<ReadwriteSplittingRuleConfiguration> {
     
     @Override
-    public void check(final String schemaName, final ReadwriteSplittingRuleConfiguration ruleConfiguration) {
-        checkDataSources(schemaName, ruleConfiguration.getDataSources());
+    public void check(final String schemaName, final ReadwriteSplittingRuleConfiguration config) {
+        checkDataSources(schemaName, config.getDataSources());
+    }
+    
+    @Override
+    public int getOrder() {
+        return ReadwriteSplittingOrder.ORDER;
+    }
+    
+    @Override
+    public Class<ReadwriteSplittingRuleConfiguration> getTypeClass() {
+        return ReadwriteSplittingRuleConfiguration.class;
     }
 }
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
new file mode 100644
index 0000000..a58d95c
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.readwritesplitting.common.rule.checker.ReadwriteSplittingRuleConfigurationChecker
+org.apache.shardingsphere.readwritesplitting.common.rule.checker.AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ShadowRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-common/src/main/java/org/apache/shardingsphere/shadow/rule/checker/ShadowRuleConfigurationChecker.java
similarity index 69%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ShadowRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-common/src/main/java/org/apache/shardingsphere/shadow/rule/checker/ShadowRuleConfigurationChecker.java
index 04155ba..19bf7fa 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ShadowRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-common/src/main/java/org/apache/shardingsphere/shadow/rule/checker/ShadowRuleConfigurationChecker.java
@@ -15,11 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.shadow.rule.checker;
 
 import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationChecker;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
 import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
+import org.apache.shardingsphere.shadow.constant.ShadowOrder;
 
 /**
  * Shadow rule configuration checker.
@@ -27,8 +28,18 @@ import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
 public final class ShadowRuleConfigurationChecker implements RuleConfigurationChecker<ShadowRuleConfiguration> {
     
     @Override
-    public void check(final String schemaName, final ShadowRuleConfiguration ruleConfiguration) {
-        boolean isShadow = !ruleConfiguration.getColumn().isEmpty() && null != ruleConfiguration.getSourceDataSourceNames() && null != ruleConfiguration.getShadowDataSourceNames();
+    public void check(final String schemaName, final ShadowRuleConfiguration config) {
+        boolean isShadow = !config.getColumn().isEmpty() && null != config.getSourceDataSourceNames() && null != config.getShadowDataSourceNames();
         Preconditions.checkState(isShadow, "No available shadow rule configuration in `%s` for governance.", schemaName);
     }
+    
+    @Override
+    public int getOrder() {
+        return ShadowOrder.ORDER;
+    }
+    
+    @Override
+    public Class<ShadowRuleConfiguration> getTypeClass() {
+        return ShadowRuleConfiguration.class;
+    }
 }
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
new file mode 100644
index 0000000..d3e2430
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.shadow.rule.checker.ShadowRuleConfigurationChecker
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractShardingRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/AbstractShardingRuleConfigurationChecker.java
similarity index 80%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractShardingRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/AbstractShardingRuleConfigurationChecker.java
index 04c0c51..ccc003d 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AbstractShardingRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/AbstractShardingRuleConfigurationChecker.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.sharding.rule.checker;
 
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationChecker;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShardingRuleConfiguration;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -29,11 +29,11 @@ import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
  */
 public abstract class AbstractShardingRuleConfigurationChecker<T extends RuleConfiguration> implements RuleConfigurationChecker<T> {
     
-    protected boolean hasAvailableTableConfigurations(final AlgorithmProvidedShardingRuleConfiguration config) {
+    protected final boolean hasAvailableTableConfigurations(final AlgorithmProvidedShardingRuleConfiguration config) {
         return !config.getTables().isEmpty() || null != config.getDefaultTableShardingStrategy() || !config.getAutoTables().isEmpty();
     }
     
-    protected boolean hasAvailableTableConfigurations(final ShardingRuleConfiguration config) {
+    protected final boolean hasAvailableTableConfigurations(final ShardingRuleConfiguration config) {
         return !config.getTables().isEmpty() || null != config.getDefaultTableShardingStrategy() || !config.getAutoTables().isEmpty();
     }
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedShardingRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/AlgorithmProvidedShardingRuleConfigurationChecker.java
similarity index 71%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedShardingRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/AlgorithmProvidedShardingRuleConfigurationChecker.java
index a4c4e7c..021e336 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/AlgorithmProvidedShardingRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/AlgorithmProvidedShardingRuleConfigurationChecker.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.sharding.rule.checker;
 
 import com.google.common.base.Preconditions;
 import org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.constant.ShardingOrder;
 
 /**
  * Algorithm provided sharding ruleConfiguration checker.
@@ -26,8 +27,17 @@ import org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShar
 public final class AlgorithmProvidedShardingRuleConfigurationChecker extends AbstractShardingRuleConfigurationChecker<AlgorithmProvidedShardingRuleConfiguration> {
     
     @Override
-    public void check(final String schemaName, final AlgorithmProvidedShardingRuleConfiguration ruleConfiguration) {
-        Preconditions.checkState(hasAvailableTableConfigurations(ruleConfiguration),
-                "No available rule configs in `%s` for governance.", schemaName);
+    public void check(final String schemaName, final AlgorithmProvidedShardingRuleConfiguration config) {
+        Preconditions.checkState(hasAvailableTableConfigurations(config), "No available rule configs in `%s` for governance.", schemaName);
+    }
+    
+    @Override
+    public int getOrder() {
+        return ShardingOrder.ALGORITHM_PROVIDER_SHARDING_ORDER;
+    }
+    
+    @Override
+    public Class<AlgorithmProvidedShardingRuleConfiguration> getTypeClass() {
+        return AlgorithmProvidedShardingRuleConfiguration.class;
     }
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ShardingRuleConfigurationChecker.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleConfigurationChecker.java
similarity index 73%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ShardingRuleConfigurationChecker.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleConfigurationChecker.java
index 44a4d6b..26c040e 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/impl/ShardingRuleConfigurationChecker.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/rule/checker/ShardingRuleConfigurationChecker.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker.impl;
+package org.apache.shardingsphere.sharding.rule.checker;
 
 import com.google.common.base.Preconditions;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.constant.ShardingOrder;
 
 /**
  * Sharding rule configuration checker.
@@ -26,8 +27,17 @@ import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
 public final class ShardingRuleConfigurationChecker extends AbstractShardingRuleConfigurationChecker<ShardingRuleConfiguration> {
     
     @Override
-    public void check(final String schemaName, final ShardingRuleConfiguration ruleConfiguration) {
-        Preconditions.checkState(hasAvailableTableConfigurations(ruleConfiguration),
-                "No available rule configs in `%s` for governance.", schemaName);
+    public void check(final String schemaName, final ShardingRuleConfiguration config) {
+        Preconditions.checkState(hasAvailableTableConfigurations(config), "No available rule configs in `%s` for governance.", schemaName);
+    }
+    
+    @Override
+    public int getOrder() {
+        return ShardingOrder.ORDER;
+    }
+    
+    @Override
+    public Class<ShardingRuleConfiguration> getTypeClass() {
+        return ShardingRuleConfiguration.class;
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
new file mode 100644
index 0000000..43050a9
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.sharding.rule.checker.ShardingRuleConfigurationChecker
+org.apache.shardingsphere.sharding.rule.checker.AlgorithmProvidedShardingRuleConfigurationChecker
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationCheckerFactory.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationCheckerFactory.java
deleted file mode 100644
index 119e322..0000000
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationCheckerFactory.java
+++ /dev/null
@@ -1,70 +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.governance.core.registry.checker;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
-import org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.AlgorithmProvidedEncryptRuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.AlgorithmProvidedShardingRuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.DatabaseDiscoveryRuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.EncryptRuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.ReadwriteSplittingRuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.ShadowRuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.impl.ShardingRuleConfigurationChecker;
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
-import org.apache.shardingsphere.readwritesplitting.common.algorithm.config.AlgorithmProvidedReadwriteSplittingRuleConfiguration;
-import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
-import org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class RuleConfigurationCheckerFactory {
-    
-    private static final Map<Class<? extends RuleConfiguration>, RuleConfigurationChecker<?>> REGISTRY = new HashMap<>();
-    
-    static {
-        REGISTRY.put(ShardingRuleConfiguration.class, new ShardingRuleConfigurationChecker());
-        REGISTRY.put(AlgorithmProvidedShardingRuleConfiguration.class, new AlgorithmProvidedShardingRuleConfigurationChecker());
-        REGISTRY.put(ReadwriteSplittingRuleConfiguration.class, new ReadwriteSplittingRuleConfigurationChecker());
-        REGISTRY.put(AlgorithmProvidedReadwriteSplittingRuleConfiguration.class, new AlgorithmProvidedReadwriteSplittingRuleConfigurationChecker());
-        REGISTRY.put(EncryptRuleConfiguration.class, new EncryptRuleConfigurationChecker());
-        REGISTRY.put(AlgorithmProvidedEncryptRuleConfiguration.class, new AlgorithmProvidedEncryptRuleConfigurationChecker());
-        REGISTRY.put(ShadowRuleConfiguration.class, new ShadowRuleConfigurationChecker());
-        REGISTRY.put(DatabaseDiscoveryRuleConfiguration.class, new DatabaseDiscoveryRuleConfigurationChecker());
-    }
-    
-    /**
-     * Get rule configuration checker.
-     * 
-     * @param ruleConfiguration rule configuration
-     * @return rule configuration checker
-     */
-    public static Optional<RuleConfigurationChecker> newInstance(final RuleConfiguration ruleConfiguration) {
-        return REGISTRY.entrySet().stream().filter(entry -> entry.getKey().isAssignableFrom(ruleConfiguration.getClass())).findFirst().map(Entry::getValue);
-    }
-}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/service/config/impl/SchemaRuleRegistryService.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/service/config/impl/SchemaRuleRegistryService.java
index 8cae1d2..aae3b43 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/service/config/impl/SchemaRuleRegistryService.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/service/config/impl/SchemaRuleRegistryService.java
@@ -19,8 +19,7 @@ package org.apache.shardingsphere.governance.core.registry.service.config.impl;
 
 import com.google.common.base.Strings;
 import com.google.common.eventbus.Subscribe;
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationChecker;
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationCheckerFactory;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationCheckerFactory;
 import org.apache.shardingsphere.governance.core.registry.listener.event.rule.RuleConfigurationsAlteredEvent;
 import org.apache.shardingsphere.governance.core.registry.service.config.SchemaBasedRegistryService;
 import org.apache.shardingsphere.governance.core.registry.service.config.node.SchemaMetadataNode;
@@ -33,7 +32,6 @@ import org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapper
 
 import java.util.Collection;
 import java.util.LinkedList;
-import java.util.Optional;
 
 /**
  * Schema rule registry service.
@@ -59,14 +57,12 @@ public final class SchemaRuleRegistryService implements SchemaBasedRegistryServi
         repository.persist(SchemaMetadataNode.getRulePath(schemaName), YamlEngine.marshal(createYamlRuleConfigurations(schemaName, configs)));
     }
     
+    @SuppressWarnings("unchecked")
     private Collection<YamlRuleConfiguration> createYamlRuleConfigurations(final String schemaName, final Collection<RuleConfiguration> ruleConfigs) {
         Collection<RuleConfiguration> configs = new LinkedList<>();
         for (RuleConfiguration each : ruleConfigs) {
-            Optional<RuleConfigurationChecker> checker = RuleConfigurationCheckerFactory.newInstance(each);
-            if (checker.isPresent()) {
-                checker.get().check(schemaName, each);
-                configs.add(each);
-            }
+            RuleConfigurationCheckerFactory.newInstance(each).check(schemaName, each);
+            configs.add(each);
         }
         return new YamlRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(configs);
     }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/checker/impl/RuleConfigurationCheckerFactoryTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/checker/impl/RuleConfigurationCheckerFactoryTest.java
deleted file mode 100644
index 6b49980..0000000
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/checker/impl/RuleConfigurationCheckerFactoryTest.java
+++ /dev/null
@@ -1,78 +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.governance.core.registry.checker.impl;
-
-import org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleConfiguration;
-import org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.governance.core.registry.checker.RuleConfigurationCheckerFactory;
-import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
-import org.apache.shardingsphere.readwritesplitting.common.algorithm.config.AlgorithmProvidedReadwriteSplittingRuleConfiguration;
-import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
-import org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class RuleConfigurationCheckerFactoryTest {
-    
-    @Test
-    public void assertShardingRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(ShardingRuleConfiguration.class)).isPresent());
-    }
-    
-    @Test
-    public void assertAlgorithmProvidedShardingRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(AlgorithmProvidedShardingRuleConfiguration.class)).isPresent());
-    }
-    
-    @Test
-    public void assertEncryptRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(EncryptRuleConfiguration.class)).isPresent());
-    }
-    
-    @Test
-    public void assertAlgorithmProvidedEncryptRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(AlgorithmProvidedEncryptRuleConfiguration.class)).isPresent());
-    }
-    
-    @Test
-    public void assertReadwriteSplittingRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(ReadwriteSplittingRuleConfiguration.class)).isPresent());
-    }
-    
-    @Test
-    public void assertAlgorithmProvidedReadwriteSplittingRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(AlgorithmProvidedReadwriteSplittingRuleConfiguration.class)).isPresent());
-    }
-    
-    @Test
-    public void assertShadowRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(ShadowRuleConfiguration.class)).isPresent());
-    }
-    
-    @Test
-    public void assertDatabaseDiscoveryRuleConfigurationChecker() {
-        assertTrue(RuleConfigurationCheckerFactory.newInstance(mock(DatabaseDiscoveryRuleConfiguration.class)).isPresent());
-    }
-}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/RuleConfigurationChecker.java
similarity index 78%
copy from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/RuleConfigurationChecker.java
index 7fd639a..b9e267c 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/RuleConfigurationChecker.java
@@ -15,22 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker;
+package org.apache.shardingsphere.infra.rule.checker;
 
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.spi.ordered.OrderedSPI;
 
 /**
  * Rule configuration checker.
  * 
  * @param <T> type of rule configuration
  */
-public interface RuleConfigurationChecker<T extends RuleConfiguration> {
+public interface RuleConfigurationChecker<T extends RuleConfiguration> extends OrderedSPI<T> {
     
     /**
      * Check rule configuration.
      * 
-     * @param schemaName schema name
-     * @param ruleConfiguration rule configuration
+     * @param schemaName schema name to be checked
+     * @param config rule configuration  to be checked
      */
-    void check(String schemaName, T ruleConfiguration);
+    void check(String schemaName, T config);
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/RuleConfigurationCheckerFactory.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/RuleConfigurationCheckerFactory.java
new file mode 100644
index 0000000..5d38b22
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/RuleConfigurationCheckerFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.infra.rule.checker;
+
+import com.google.common.base.Preconditions;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Rule configuration checker factory.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class RuleConfigurationCheckerFactory {
+    
+    static {
+        ShardingSphereServiceLoader.register(RuleConfigurationChecker.class);
+    }
+    
+    /**
+     * Create new instance of rule configuration checker.
+     * 
+     * @param config rule configuration
+     * @return new instance of rule configuration checker
+     */
+    @SuppressWarnings("rawtypes")
+    public static RuleConfigurationChecker newInstance(final RuleConfiguration config) {
+        Map<Class<?>, RuleConfigurationChecker> checkers = OrderedSPIRegistry.getRegisteredServicesByClass(Collections.singleton(config.getClass()), RuleConfigurationChecker.class);
+        Preconditions.checkArgument(checkers.containsKey(config.getClass()), "Can not find rule configuration checker for rule type: `%s`", config.getClass());
+        return checkers.get(config.getClass());
+    }
+}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/api/GovernanceShardingSphereDataSourceFactoryTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/api/GovernanceShardingSphereDataSourceFactoryTest.java
index a3e3eea..5fd76fd 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/api/GovernanceShardingSphereDataSourceFactoryTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/api/GovernanceShardingSphereDataSourceFactoryTest.java
@@ -17,10 +17,10 @@
 
 package org.apache.shardingsphere.driver.governance.api;
 
+import org.apache.shardingsphere.driver.governance.fixture.TestRuleConfiguration;
 import org.apache.shardingsphere.driver.governance.internal.datasource.GovernanceShardingSphereDataSource;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
 import org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
 import org.junit.Test;
 
 import javax.sql.DataSource;
@@ -45,14 +45,14 @@ public final class GovernanceShardingSphereDataSourceFactoryTest {
     
     @Test
     public void assertCreateDataSourceWhenRuleConfigurationsNotEmpty() throws SQLException {
-        DataSource dataSource = GovernanceShardingSphereDataSourceFactory.createDataSource(createDataSourceMap(), Collections.singletonList(mock(RuleConfiguration.class)),
+        DataSource dataSource = GovernanceShardingSphereDataSourceFactory.createDataSource(createDataSourceMap(), Collections.singletonList(new TestRuleConfiguration()),
                 new Properties(), createGovernanceConfiguration());
         assertTrue(dataSource instanceof GovernanceShardingSphereDataSource);
     }
     
     @Test
     public void assertCreateDataSourceWithGivenDataSource() throws SQLException {
-        DataSource dataSource = GovernanceShardingSphereDataSourceFactory.createDataSource(createDataSource(), Collections.singletonList(mock(RuleConfiguration.class)),
+        DataSource dataSource = GovernanceShardingSphereDataSourceFactory.createDataSource(createDataSource(), Collections.singletonList(new TestRuleConfiguration()),
                 new Properties(), createGovernanceConfiguration());
         assertTrue(dataSource instanceof GovernanceShardingSphereDataSource);
     }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRuleConfiguration.java
similarity index 66%
copy from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java
copy to shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRuleConfiguration.java
index 7fd639a..40e2790 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRuleConfiguration.java
@@ -15,22 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker;
+package org.apache.shardingsphere.driver.governance.fixture;
 
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 
-/**
- * Rule configuration checker.
- * 
- * @param <T> type of rule configuration
- */
-public interface RuleConfigurationChecker<T extends RuleConfiguration> {
-    
-    /**
-     * Check rule configuration.
-     * 
-     * @param schemaName schema name
-     * @param ruleConfiguration rule configuration
-     */
-    void check(String schemaName, T ruleConfiguration);
+public final class TestRuleConfiguration implements RuleConfiguration {
 }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRuleConfigurationChecker.java
similarity index 59%
rename from shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRuleConfigurationChecker.java
index 7fd639a..8285979 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/checker/RuleConfigurationChecker.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRuleConfigurationChecker.java
@@ -15,22 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.checker;
+package org.apache.shardingsphere.driver.governance.fixture;
 
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker;
 
-/**
- * Rule configuration checker.
- * 
- * @param <T> type of rule configuration
- */
-public interface RuleConfigurationChecker<T extends RuleConfiguration> {
+public final class TestRuleConfigurationChecker implements RuleConfigurationChecker<TestRuleConfiguration> {
+    
+    @Override
+    public void check(final String schemaName, final TestRuleConfiguration config) {
+    }
+    
+    @Override
+    public int getOrder() {
+        return 10080;
+    }
     
-    /**
-     * Check rule configuration.
-     * 
-     * @param schemaName schema name
-     * @param ruleConfiguration rule configuration
-     */
-    void check(String schemaName, T ruleConfiguration);
+    @Override
+    public Class<TestRuleConfiguration> getTypeClass() {
+        return TestRuleConfiguration.class;
+    }
 }
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
new file mode 100644
index 0000000..aa189db
--- /dev/null
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.checker.RuleConfigurationChecker
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.driver.governance.fixture.TestRuleConfigurationChecker