Merge pull request #183 from huangjian888/dev

Add Nacos configuration center example
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/pom.xml b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/pom.xml
index 2a56042..08b0fc9 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/pom.xml
+++ b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/pom.xml
@@ -27,13 +27,23 @@
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>sharding-jdbc-orchestration</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.apache.shardingsphere</groupId>-->
+            <!--<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>-->
+        <!--</dependency>-->
         <!--<dependency>-->
             <!--<groupId>io.shardingsphere</groupId>-->
             <!--<artifactId>sharding-orchestration-reg-etcd</artifactId>-->
         <!--</dependency>-->
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>sharding-orchestration-reg-nacos</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.nacos</groupId>
+            <artifactId>nacos-client</artifactId>
+            <version>1.0.0</version>
+        </dependency>
     </dependencies>
 </project>
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/JavaConfigurationExampleMain.java b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/JavaConfigurationExampleMain.java
index 939e768..11de1b3 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/JavaConfigurationExampleMain.java
+++ b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/JavaConfigurationExampleMain.java
@@ -42,17 +42,18 @@
  * 3. Please make sure sharding-orchestration-reg-etcd in your pom if registryCenterType = RegistryCenterType.ETCD.
  */
 public class JavaConfigurationExampleMain {
-    
+
     private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES;
 //    private static ShardingType shardingType = ShardingType.MASTER_SLAVE;
 //    private static ShardingType shardingType = ShardingType.ENCRYPT;
-    
+
     private static boolean loadConfigFromRegCenter = false;
 //    private static boolean loadConfigFromRegCenter = true;
-    
-    private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
+
+    //    private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
     //    private static RegistryCenterType registryCenterType = RegistryCenterType.ETCD;
-    
+    private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;
+
     public static void main(final String[] args) throws Exception {
         DataSource dataSource = getDataSource(shardingType, loadConfigFromRegCenter);
         try {
@@ -61,7 +62,7 @@
             closeDataSource(dataSource);
         }
     }
-    
+
     private static DataSource getDataSource(final ShardingType shardingType, final boolean loadConfigFromRegCenter) throws SQLException {
         RegistryCenterConfiguration registryCenterConfig = getRegistryCenterConfiguration(registryCenterType);
         ExampleConfiguration configuration;
@@ -81,15 +82,16 @@
         }
         return configuration.getDataSource();
     }
-    
+
     private static RegistryCenterConfiguration getRegistryCenterConfiguration(final RegistryCenterType registryCenterType) {
-        return RegistryCenterType.ZOOKEEPER == registryCenterType ? RegistryCenterConfigurationUtil.getZooKeeperConfiguration() : RegistryCenterConfigurationUtil.getEtcdConfiguration();
+        return RegistryCenterType.ZOOKEEPER == registryCenterType ? RegistryCenterConfigurationUtil.getZooKeeperConfiguration()
+                : RegistryCenterType.NACOS == registryCenterType ? RegistryCenterConfigurationUtil.getNacosConfiguration() : RegistryCenterConfigurationUtil.getEtcdConfiguration();
     }
-    
+
     private static ExampleService getExampleService(final DataSource dataSource) {
         return new OrderServiceImpl(dataSource);
     }
-    
+
     private static void closeDataSource(final DataSource dataSource) throws Exception {
         if (dataSource instanceof AbstractDataSourceAdapter) {
             ((AbstractDataSourceAdapter) dataSource).close();
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/YamlConfigurationExampleMain.java b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/YamlConfigurationExampleMain.java
index 8d03690..2579858 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/YamlConfigurationExampleMain.java
+++ b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/YamlConfigurationExampleMain.java
@@ -46,9 +46,10 @@
     private static boolean loadConfigFromRegCenter = false;
 //    private static boolean loadConfigFromRegCenter = true;
     
-    private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
+//    private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
 //    private static RegistryCenterType registryCenterType = RegistryCenterType.ETCD;
-    
+    private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;
+
     public static void main(final String[] args) throws Exception {
         DataSource dataSource = getDataSource(registryCenterType, loadConfigFromRegCenter, shardingType);
         try {
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/RegistryCenterConfigurationUtil.java b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/RegistryCenterConfigurationUtil.java
index d2c2ca1..ec7d7c5 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/RegistryCenterConfigurationUtil.java
+++ b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/RegistryCenterConfigurationUtil.java
@@ -19,6 +19,8 @@
 
 import org.apache.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
 
+import java.util.Properties;
+
 public class RegistryCenterConfigurationUtil {
     
     private static final String ZOOKEEPER_CONNECTION_STRING = "localhost:2181";
@@ -26,6 +28,10 @@
     private static final String NAMESPACE = "orchestration-java-demo";
     
     private static final String ETCD_CONNECTION_STRING = "http://localhost:2379";
+
+    private static final String NACOS_CONNECTION_STRING = "localhost:8848";
+
+    private static final String NACOS_NAMESPACE = "";
     
     public static RegistryCenterConfiguration getZooKeeperConfiguration() {
         RegistryCenterConfiguration result = new RegistryCenterConfiguration("zookeeper");
@@ -39,4 +45,14 @@
         result.setServerLists(ETCD_CONNECTION_STRING);
         return result;
     }
+
+    public static RegistryCenterConfiguration getNacosConfiguration() {
+        Properties properties = new Properties();
+        properties.setProperty("group", "SHARDING_SPHERE_DEFAULT_GROUP");
+        properties.setProperty("timeout", "3000");
+        RegistryCenterConfiguration result = new RegistryCenterConfiguration("nacos", properties);
+        result.setServerLists(NACOS_CONNECTION_STRING);
+        result.setNamespace(NACOS_NAMESPACE);
+        return result;
+    }
 }
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/cloud/CloudShardingDatabasesAndTablesConfiguration.java b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/cloud/CloudShardingDatabasesAndTablesConfiguration.java
index fa71b98..22ba77e 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/cloud/CloudShardingDatabasesAndTablesConfiguration.java
+++ b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/cloud/CloudShardingDatabasesAndTablesConfiguration.java
@@ -28,7 +28,7 @@
 public final class CloudShardingDatabasesAndTablesConfiguration implements ExampleConfiguration {
     
     private final RegistryCenterConfiguration registryCenterConfig;
-    
+
     public CloudShardingDatabasesAndTablesConfiguration(final RegistryCenterConfiguration registryCenterConfig) {
         this.registryCenterConfig = registryCenterConfig;
     }
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
new file mode 100644
index 0000000..1f9d3cd
--- /dev/null
+++ b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
@@ -0,0 +1,10 @@
+orchestration:
+  name: demo_yaml_ds_sharding
+  overwrite: false
+  registry:
+    type: nacos
+    serverLists: localhost:8848
+    namespace:
+    props:
+      group: SHARDING_SPHERE_DEFAULT_GROUP
+      timeout: 3000
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
new file mode 100644
index 0000000..2d173d9
--- /dev/null
+++ b/sharding-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
@@ -0,0 +1,56 @@
+dataSources:
+  ds_0: !!com.zaxxer.hikari.HikariDataSource
+    driverClassName: com.mysql.jdbc.Driver
+    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
+    username: root
+    password: 123456
+  ds_1: !!com.zaxxer.hikari.HikariDataSource
+    driverClassName: com.mysql.jdbc.Driver
+    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
+    username: root
+    password: 123456
+
+shardingRule:
+  tables:
+    t_order: 
+      actualDataNodes: ds_${0..1}.t_order_${0..1}
+      tableStrategy:
+        inline:
+          shardingColumn: order_id
+          algorithmExpression: t_order_${order_id % 2}
+      keyGenerator:
+        column: order_id
+        type: SNOWFLAKE
+        props:
+          worker.id: 123
+    t_order_item:
+      actualDataNodes: ds_${0..1}.t_order_item_${0..1}
+      tableStrategy:
+        inline:
+          shardingColumn: order_id
+          algorithmExpression: t_order_item_${order_id % 2}  
+  bindingTables:
+    - t_order,t_order_item
+  broadcastTables:
+    - t_address
+  
+  defaultDatabaseStrategy:
+    inline:
+      shardingColumn: user_id
+      algorithmExpression: ds_${user_id % 2}
+  defaultTableStrategy:
+    none:
+
+props:
+  sql.show: true
+
+orchestration:
+  name: demo_yaml_ds_sharding
+  overwrite: true
+  registry:
+    type: nacos
+    serverLists: localhost:8848
+    namespace:
+    props:
+      group: SHARDING_SPHERE_DEFAULT_GROUP
+      timeout: 3000
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/pom.xml b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/pom.xml
index f6523de..be61756 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/pom.xml
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/pom.xml
@@ -21,15 +21,25 @@
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>sharding-jdbc-orchestration-spring-boot-starter</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.apache.shardingsphere</groupId>-->
+            <!--<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>-->
+        <!--</dependency>-->
         <!--<dependency>-->
             <!--<groupId>io.shardingsphere</groupId>-->
             <!--<artifactId>sharding-orchestration-reg-etcd</artifactId>-->
         <!--</dependency>-->
         <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>sharding-orchestration-reg-nacos</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.nacos</groupId>
+            <artifactId>nacos-client</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+        <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-jpa</artifactId>
         </dependency>
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-cloud-nacos-sharding-databases-tables.properties b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-cloud-nacos-sharding-databases-tables.properties
new file mode 100644
index 0000000..23acaa5
--- /dev/null
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-cloud-nacos-sharding-databases-tables.properties
@@ -0,0 +1,7 @@
+spring.shardingsphere.orchestration.name=demo_spring_boot_ds_sharding
+spring.shardingsphere.orchestration.overwrite=false
+spring.shardingsphere.orchestration.registry.type=nacos
+spring.shardingsphere.orchestration.registry.server-lists=localhost:8848
+spring.shardingsphere.orchestration.registry.namespace=
+spring.shardingsphere.orchestration.registry.props.group=SHARDING_SPHERE_DEFAULT_GROUP
+spring.shardingsphere.orchestration.registry.props.timeout=3000
\ No newline at end of file
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-local-nacos-sharding-databases-tables.properties b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-local-nacos-sharding-databases-tables.properties
new file mode 100644
index 0000000..efd8af4
--- /dev/null
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application-local-nacos-sharding-databases-tables.properties
@@ -0,0 +1,42 @@
+spring.shardingsphere.datasource.names=ds_0,ds_1
+
+spring.shardingsphere.datasource.ds_0.type=com.zaxxer.hikari.HikariDataSource
+spring.shardingsphere.datasource.ds_0.driver-class-name=com.mysql.jdbc.Driver
+spring.shardingsphere.datasource.ds_0.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
+spring.shardingsphere.datasource.ds_0.username=root
+spring.shardingsphere.datasource.ds_0.password=123456
+spring.shardingsphere.datasource.ds_0.max-active=16
+
+spring.shardingsphere.datasource.ds_1.type=com.zaxxer.hikari.HikariDataSource
+spring.shardingsphere.datasource.ds_1.driver-class-name=com.mysql.jdbc.Driver
+spring.shardingsphere.datasource.ds_1.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
+spring.shardingsphere.datasource.ds_1.username=root
+spring.shardingsphere.datasource.ds_1.password=123456
+spring.shardingsphere.datasource.ds_1.max-active=16
+
+spring.shardingsphere.sharding.default-database-strategy.inline.sharding-column=user_id
+spring.shardingsphere.sharding.default-database-strategy.inline.algorithm-expression=ds_$->{user_id % 2}
+
+spring.shardingsphere.sharding.binding-tables=t_order,t_order_item
+spring.shardingsphere.sharding.default-datasource-name=ds_0
+spring.shardingsphere.sharding.broadcast-tables=t_address
+
+spring.shardingsphere.sharding.tables.t_order.actual-data-nodes=ds_$->{0..1}.t_order_$->{0..1}
+spring.shardingsphere.sharding.tables.t_order.table-strategy.inline.sharding-column=order_id
+spring.shardingsphere.sharding.tables.t_order.table-strategy.inline.algorithm-expression=t_order_$->{order_id % 2}
+spring.shardingsphere.sharding.tables.t_order.key-generator.column=order_id
+spring.shardingsphere.sharding.tables.t_order.key-generator.type=SNOWFLAKE
+spring.shardingsphere.sharding.tables.t_order.key-generator.props.worker.id=123
+
+spring.shardingsphere.sharding.tables.t_order_item.actual-data-nodes=ds_$->{0..1}.t_order_item_$->{0..1}
+spring.shardingsphere.sharding.tables.t_order_item.table-strategy.inline.sharding-column=order_id
+spring.shardingsphere.sharding.tables.t_order_item.table-strategy.inline.algorithm-expression=t_order_item_$->{order_id % 2}
+spring.shardingsphere.sharding.tables.t_order_item.key-generator.column=order_item_id
+spring.shardingsphere.sharding.tables.t_order_item.key-generator.type=SNOWFLAKE
+spring.shardingsphere.sharding.tables.t_order_item.key-generator.props.worker.id=123
+
+spring.shardingsphere.orchestration.name=demo_spring_boot_ds_sharding
+spring.shardingsphere.orchestration.overwrite=true
+spring.shardingsphere.orchestration.registry.type=nacos
+spring.shardingsphere.orchestration.registry.server-lists=localhost:8848
+spring.shardingsphere.orchestration.registry.namespace=
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application.properties b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application.properties
index c911e4f..eeac173 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application.properties
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-boot-example/src/main/resources/application.properties
@@ -2,7 +2,7 @@
 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
 spring.jpa.properties.hibernate.show_sql=false
 
-spring.profiles.active=local-zookeeper-sharding-databases-tables
+#spring.profiles.active=local-zookeeper-sharding-databases-tables
 #spring.profiles.active=local-zookeeper-master-slave
 
 #spring.profiles.active=local-etcd-sharding-databases-tables
@@ -16,3 +16,6 @@
 
 #spring.profiles.active=local-zookeeper-encrypt
 #spring.profiles.active=cloud-zookeeper-encrypt
+
+spring.profiles.active=local-nacos-sharding-databases-tables
+#spring.profiles.active=cloud-nacos-sharding-databases-tables
\ No newline at end of file
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/pom.xml b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/pom.xml
index ad70e58..875a453 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/pom.xml
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/pom.xml
@@ -30,14 +30,23 @@
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>sharding-jdbc-orchestration-spring-namespace</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.apache.shardingsphere</groupId>-->
+            <!--<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>-->
+        <!--</dependency>-->
         <!--<dependency>-->
             <!--<groupId>io.shardingsphere</groupId>-->
             <!--<artifactId>sharding-orchestration-reg-etcd</artifactId>-->
         <!--</dependency>-->
-        
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>sharding-orchestration-reg-nacos</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.nacos</groupId>
+            <artifactId>nacos-client</artifactId>
+            <version>1.0.0</version>
+        </dependency>
     </dependencies>
 </project>
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/orchestration/spring/namespace/ExampleMain.java b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/orchestration/spring/namespace/ExampleMain.java
index 6f0fa2c..1f118cf 100755
--- a/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/orchestration/spring/namespace/ExampleMain.java
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/java/org/apache/shardingsphere/example/orchestration/spring/namespace/ExampleMain.java
@@ -35,9 +35,10 @@
     private static boolean loadConfigFromRegCenter = false;
 //    private static boolean loadConfigFromRegCenter = true;
     
-    private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
+//    private static RegistryCenterType registryCenterType = RegistryCenterType.ZOOKEEPER;
 //    private static RegistryCenterType registryCenterType = RegistryCenterType.ETCD;
-    
+    private static RegistryCenterType registryCenterType = RegistryCenterType.NACOS;
+
     public static void main(final String[] args) throws SQLException {
         try (ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(getApplicationFile())) {
             ExampleExecuteTemplate.run(applicationContext.getBean(ExampleService.class));
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-sharding-databases-tables.xml b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-sharding-databases-tables.xml
new file mode 100644
index 0000000..6c6cc78
--- /dev/null
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/cloud/application-sharding-databases-tables.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xmlns:orchestration="http://shardingsphere.apache.org/schema/shardingsphere/orchestration"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                        http://www.springframework.org/schema/beans/spring-beans.xsd
+                        http://www.springframework.org/schema/context
+                        http://www.springframework.org/schema/context/spring-context.xsd
+                        http://www.springframework.org/schema/tx
+                        http://www.springframework.org/schema/tx/spring-tx.xsd
+                        http://shardingsphere.apache.org/schema/shardingsphere/orchestration
+                        http://shardingsphere.apache.org/schema/shardingsphere/orchestration/orchestration.xsd">
+    <import resource="classpath*:META-INF/nacos/registry-center.xml" />
+    <context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
+
+    <orchestration:sharding-data-source id="shardingDatabasesTablesDataSource" registry-center-ref="regCenter" />
+    
+    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+        <property name="dataSource" ref="shardingDatabasesTablesDataSource" />
+    </bean>
+    <tx:annotation-driven />
+    
+    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
+        <property name="dataSource" ref="shardingDatabasesTablesDataSource"/>
+        <property name="mapperLocations" value="classpath*:META-INF/mappers/*.xml"/>
+    </bean>
+    
+    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
+        <property name="basePackage" value="org.apache.shardingsphere.example.core.mybatis.repository"/>
+        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
+    </bean>
+</beans>
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-sharding-databases-tables.xml b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-sharding-databases-tables.xml
new file mode 100644
index 0000000..81d679a
--- /dev/null
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/local/application-sharding-databases-tables.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xmlns:sharding="http://shardingsphere.apache.org/schema/shardingsphere/sharding"
+       xmlns:orchestraion="http://shardingsphere.apache.org/schema/shardingsphere/orchestration"
+       xmlns:bean="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                        http://www.springframework.org/schema/beans/spring-beans.xsd 
+                        http://www.springframework.org/schema/tx 
+                        http://www.springframework.org/schema/tx/spring-tx.xsd
+                        http://www.springframework.org/schema/context 
+                        http://www.springframework.org/schema/context/spring-context.xsd
+                        http://shardingsphere.apache.org/schema/shardingsphere/sharding
+                        http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding.xsd
+                        http://shardingsphere.apache.org/schema/shardingsphere/orchestration
+                        http://shardingsphere.apache.org/schema/shardingsphere/orchestration/orchestration.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
+    <import resource="classpath*:META-INF/nacos/registry-center.xml" />
+    <context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
+    <bean id="demo_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
+        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
+        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;serverTimezone=UTC"/>
+        <property name="username" value="root"/>
+        <property name="password" value="123456"/>
+    </bean>
+    
+    <bean id="demo_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
+        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
+        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;serverTimezone=UTC"/>
+        <property name="username" value="root"/>
+        <property name="password" value="123456"/>
+    </bean>
+    
+    <sharding:inline-strategy id="databaseStrategy" sharding-column="user_id" algorithm-expression="demo_ds_${user_id % 2}" />
+    <sharding:inline-strategy id="orderTableStrategy" sharding-column="order_id" algorithm-expression="t_order_${order_id % 2}" />
+    <sharding:inline-strategy id="orderItemTableStrategy" sharding-column="order_id" algorithm-expression="t_order_item_${order_id % 2}" />
+    
+    <bean:properties id="properties">
+        <prop key="worker.id">123</prop>
+    </bean:properties>
+    
+    <sharding:key-generator id="orderKeyGenerator" type="SNOWFLAKE" column="order_id" props-ref="properties" />
+    <sharding:key-generator id="itemKeyGenerator" type="SNOWFLAKE" column="order_item_id" props-ref="properties" />
+    
+    <sharding:data-source id="realShardingDatabasesTablesDataSource">
+        <sharding:sharding-rule data-source-names="demo_ds_0, demo_ds_1">
+            <sharding:table-rules>
+                <sharding:table-rule logic-table="t_order" actual-data-nodes="demo_ds_${0..1}.t_order_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderTableStrategy" key-generator-ref="orderKeyGenerator" />
+                <sharding:table-rule logic-table="t_order_item" actual-data-nodes="demo_ds_${0..1}.t_order_item_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderItemTableStrategy" key-generator-ref="itemKeyGenerator" />
+            </sharding:table-rules>
+            <sharding:binding-table-rules>
+                <sharding:binding-table-rule logic-tables="t_order, t_order_item"/>
+            </sharding:binding-table-rules>
+            <sharding:broadcast-table-rules>
+                <sharding:broadcast-table-rule table="t_address"/>
+            </sharding:broadcast-table-rules>
+        </sharding:sharding-rule>
+    </sharding:data-source>
+    <orchestraion:sharding-data-source id="shardingDatabasesTablesDataSource" data-source-ref="realShardingDatabasesTablesDataSource" registry-center-ref="regCenter" overwrite="true" />
+    
+    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+        <property name="dataSource" ref="shardingDatabasesTablesDataSource" />
+    </bean>
+    <tx:annotation-driven />
+    
+    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
+        <property name="dataSource" ref="shardingDatabasesTablesDataSource"/>
+        <property name="mapperLocations" value="classpath*:META-INF/mappers/*.xml"/>
+    </bean>
+
+    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
+        <property name="basePackage" value="org.apache.shardingsphere.example.core.mybatis.repository"/>
+        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
+    </bean>
+</beans>
diff --git a/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/registry-center.xml b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/registry-center.xml
new file mode 100644
index 0000000..3dc30cf
--- /dev/null
+++ b/sharding-jdbc-example/orchestration-example/orchestration-spring-namespace-example/src/main/resources/META-INF/nacos/registry-center.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:orchestraion="http://shardingsphere.apache.org/schema/shardingsphere/orchestration"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://shardingsphere.apache.org/schema/shardingsphere/orchestration
+                           http://shardingsphere.apache.org/schema/shardingsphere/orchestration/orchestration.xsd">
+    <orchestraion:registry-center id="regCenter" type="nacos" server-lists="localhost:8848" namespace="" operation-timeout-milliseconds="1000" max-retries="3" />
+</beans>