You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/01/20 13:04:00 UTC

[shardingsphere] branch master updated: Refactor example generator to SPI and pluggable (#14959)

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

panjuan 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 bc2936e  Refactor example generator to SPI and pluggable (#14959)
bc2936e is described below

commit bc2936e3d57c1ef49b1a654845cc53a4240db095
Author: Liang Zhang <te...@163.com>
AuthorDate: Thu Jan 20 21:03:02 2022 +0800

    Refactor example generator to SPI and pluggable (#14959)
---
 .../example/generator/ExampleGenerator.java        |   7 +-
 .../example/generator/ExampleTemplateFactory.java  | 119 ---------------------
 .../ExampleScenario.java}                          |  38 ++++---
 .../generator/scenario/ExampleScenarioFactory.java |  88 +++++++++++++++
 .../feature/FeatureExampleScenario.java}           |  19 +---
 .../feature/type/EncryptExampleScenario.java       |  48 +++++++++
 .../type/ReadwriteSplittingExampleScenario.java}   |  33 +++---
 .../feature/type/ShadowExampleScenario.java}       |  33 +++---
 .../feature/type/ShardingExampleScenario.java}     |  33 +++---
 .../framework/FrameworkExampleScenario.java}       |  19 +---
 .../framework/type/JDBCExampleScenario.java        |  50 +++++++++
 .../type/SpringBootStarterJdbcExampleScenario.java |  50 +++++++++
 .../type/SpringBootStarterJpaExampleScenario.java  |  50 +++++++++
 .../SpringBootStarterMyBatisExampleScenario.java   |  53 +++++++++
 .../type/SpringNamespaceJdbcExampleScenario.java   |  50 +++++++++
 .../type/SpringNamespaceJpaExampleScenario.java    |  50 +++++++++
 .../SpringNamespaceMyBatisExampleScenario.java     |  53 +++++++++
 ...erator.scenario.feature.FeatureExampleScenario} |  13 +--
 ...or.scenario.framework.FrameworkExampleScenario} |  16 ++-
 .../src/main/resources/data-model/data-model.yaml  |   3 +-
 20 files changed, 601 insertions(+), 224 deletions(-)

diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGenerator.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGenerator.java
index 8c42511..4a8e6aa 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGenerator.java
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleGenerator.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.example.generator;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
+import org.apache.shardingsphere.example.generator.scenario.ExampleScenarioFactory;
 import org.yaml.snakeyaml.Yaml;
 
 import java.io.File;
@@ -82,8 +83,10 @@ public final class ExampleGenerator {
     public void generate() throws IOException, TemplateException {
         try (InputStream input = ExampleGenerator.class.getResourceAsStream(DATA_MODEL_PATH)) {
             Map<String, String> dataModel = new Yaml().loadAs(input, Map.class);
-            generateFile(dataModel, ExampleTemplateFactory.getJavaClassTemplateMap(dataModel), JAVA_CLASS_PATH);
-            generateFile(dataModel, ExampleTemplateFactory.getResourceTemplateMap(dataModel), RESOURCES_PATH);
+            String feature = dataModel.get("feature");
+            String framework = dataModel.get("framework");
+            generateFile(dataModel, new ExampleScenarioFactory(feature, framework).getJavaClassTemplateMap(), JAVA_CLASS_PATH);
+            generateFile(dataModel, new ExampleScenarioFactory(feature, framework).getResourceTemplateMap(), RESOURCES_PATH);
         }
     }
     
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleTemplateFactory.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleTemplateFactory.java
deleted file mode 100644
index 88fdcf01..0000000
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/ExampleTemplateFactory.java
+++ /dev/null
@@ -1,119 +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.example.generator;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Example template factory.
- */
-public final class ExampleTemplateFactory {
-    
-    private static final String FRAMEWORK_KEY = "framework";
-    
-    private static final String FEATURE_KEY = "feature";
-    
-    /**
-     * Get java class template map.
-     * 
-     * @param dataModel data model
-     * @return java class template map
-     */
-    public static Map<String, String> getJavaClassTemplateMap(final Map<String, String> dataModel) {
-        Map<String, String> result = new HashMap<>(10, 1);
-        result.put("java/Example.ftl", "Example.java");
-        result.put("java/ExampleService.ftl", "ExampleService.java");
-        result.put("java/entity/Order.ftl", "entity/Order.java");
-        result.put("java/entity/OrderItem.ftl", "entity/OrderItem.java");
-        result.put("java/entity/Address.ftl", "entity/Address.java");
-        switch (dataModel.get(FRAMEWORK_KEY)) {
-            case "jdbc":
-                result.put("java/config/Configuration.ftl", "Configuration.java");
-                result.put("java/repository/jdbc/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
-                result.put("java/repository/jdbc/OrderRepository.ftl", "repository/OrderRepository.java");
-                result.put("java/repository/jdbc/AddressRepository.ftl", "repository/AddressRepository.java");
-                break;
-            case "springboot-starter-jdbc":
-            case "spring-namespace-jdbc":
-                result.put("java/repository/jdbc/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
-                result.put("java/repository/jdbc/OrderRepository.ftl", "repository/OrderRepository.java");
-                result.put("java/repository/jdbc/AddressRepository.ftl", "repository/AddressRepository.java");
-                break;
-            case "jpa":
-            case "springboot-starter-jpa":
-            case "spring-namespace-jpa":
-                result.put("java/repository/jpa/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
-                result.put("java/repository/jpa/OrderRepository.ftl", "repository/OrderRepository.java");
-                result.put("java/repository/jpa/AddressRepository.ftl", "repository/AddressRepository.java");
-                break;
-            case "mybatis":
-            case "springboot-starter-mybatis":
-            case "spring-namespace-mybatis":
-                result.put("java/repository/mybatis/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
-                result.put("java/repository/mybatis/OrderRepository.ftl", "repository/OrderRepository.java");
-                result.put("java/repository/mybatis/AddressRepository.ftl", "repository/AddressRepository.java");
-                break;
-            default:
-                break;
-        }
-        if (dataModel.getOrDefault(FEATURE_KEY, "").contains(FeatureType.ENCRYPT.getFeature())) {
-            result.put("java/TestQueryAssistedShardingEncryptAlgorithm.ftl", "TestQueryAssistedShardingEncryptAlgorithm.java");
-        }
-        return result;
-    }
-    
-    /**
-     * Get resource template map.
-     * 
-     * @param dataModel data model
-     * @return resource template map
-     */
-    public static Map<String, String> getResourceTemplateMap(final Map<String, String> dataModel) {
-        Map<String, String> result = new HashMap<>(6, 1);
-        switch (dataModel.get(FRAMEWORK_KEY)) {
-            case "springboot-starter-jdbc":
-            case "springboot-starter-jpa":
-                result.put("resources/properties/application.ftl", "application.properties");
-                break;
-            case "spring-namespace-jdbc":
-            case "spring-namespace-jpa":
-                result.put("resources/xml/application.ftl", "application.xml");
-                break;
-            case "spring-namespace-mybatis":
-                result.put("resources/xml/application.ftl", "application.xml");
-                result.put("resources/mappers/OrderItemMapper.ftl", "mappers/OrderItemMapper.xml");
-                result.put("resources/mappers/OrderMapper.ftl", "mappers/OrderMapper.xml");
-                result.put("resources/mappers/AddressMapper.ftl", "mappers/AddressMapper.xml");
-                break;
-            case "springboot-starter-mybatis":
-                result.put("resources/properties/application.ftl", "application.properties");
-                result.put("resources/mappers/OrderItemMapper.ftl", "mappers/OrderItemMapper.xml");
-                result.put("resources/mappers/OrderMapper.ftl", "mappers/OrderMapper.xml");
-                result.put("resources/mappers/AddressMapper.ftl", "mappers/AddressMapper.xml");
-                break;
-            default:
-                break;
-        }
-        if (dataModel.getOrDefault(FEATURE_KEY, "").contains(FeatureType.ENCRYPT.getFeature())) {
-            result.put("resources/spi/encryptAlgorithm.ftl", "META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm");
-        }
-        result.put("resources/logback.ftl", "logback.xml");
-        return result;
-    }
-}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FrameworkType.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/ExampleScenario.java
similarity index 57%
rename from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FrameworkType.java
rename to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/ExampleScenario.java
index 59dfb3e..c8e96dc 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FrameworkType.java
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/ExampleScenario.java
@@ -15,25 +15,33 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.example.generator;
+package org.apache.shardingsphere.example.generator.scenario;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import java.util.Map;
 
 /**
- * Framework type.
+ * Example scenario.
  */
-@RequiredArgsConstructor
-@Getter
-public enum FrameworkType {
+public interface ExampleScenario {
     
-    JDBC("jdbc"),
-    SPRING_BOOT_STARTER_JDBC("spring-boot-starter-jdbc"),
-    SPRING_BOOT_STARTER_JPA("spring-boot-starter-jpa"),
-    SPRING_BOOT_STARTER_MYBATIS("spring-boot-starter-mybatis"),
-    SPRING_BOOT_NAMESPACE_JDBC("spring-namespace-jdbc"),
-    SPRING_BOOT_NAMESPACE_JPA("spring-namespace-jpa"),
-    SPRING_BOOT_NAMESPACE_MYBATIS("spring-namespace-mybatis");
+    /**
+     * Get java class template map.
+     * 
+     * @return java class template map
+     */
+    Map<String, String> getJavaClassTemplateMap();
     
-    private final String framework;
+    /**
+     * Get resource template map.
+     *
+     * @return resource template map
+     */
+    Map<String, String> getResourceTemplateMap();
+    
+    /**
+     * Get scenario type.
+     * 
+     * @return scenario type
+     */
+    String getType();
 }
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/ExampleScenarioFactory.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/ExampleScenarioFactory.java
new file mode 100644
index 0000000..4a98f30
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/ExampleScenarioFactory.java
@@ -0,0 +1,88 @@
+/*
+ * 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.example.generator.scenario;
+
+import org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario;
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ServiceLoader;
+
+/**
+ * Example scenario factory.
+ */
+public final class ExampleScenarioFactory {
+    
+    private final FeatureExampleScenario featureScenario;
+    
+    private final FrameworkExampleScenario frameworkScenario;
+    
+    public ExampleScenarioFactory(final String feature, final String framework) {
+        featureScenario = getFeatureScenario(feature);
+        frameworkScenario = getFrameworkScenario(framework);
+    }
+    
+    private FeatureExampleScenario getFeatureScenario(final String feature) {
+        for (FeatureExampleScenario each : ServiceLoader.load(FeatureExampleScenario.class)) {
+            if (each.getType().equals(feature)) {
+                return each;
+            }
+        }
+        throw new UnsupportedOperationException(String.format("Can not support example scenario with feature `%s`.", feature));
+    }
+    
+    private FrameworkExampleScenario getFrameworkScenario(final String framework) {
+        for (FrameworkExampleScenario each : ServiceLoader.load(FrameworkExampleScenario.class)) {
+            if (each.getType().equals(framework)) {
+                return each;
+            }
+        }
+        throw new UnsupportedOperationException(String.format("Can not support example scenario with framework `%s`.", framework));
+    }
+    
+    /**
+     * Get java class template map.
+     *
+     * @return java class template map
+     */
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>();
+        result.put("java/Example.ftl", "Example.java");
+        result.put("java/ExampleService.ftl", "ExampleService.java");
+        result.put("java/entity/Order.ftl", "entity/Order.java");
+        result.put("java/entity/OrderItem.ftl", "entity/OrderItem.java");
+        result.put("java/entity/Address.ftl", "entity/Address.java");
+        result.putAll(featureScenario.getJavaClassTemplateMap());
+        result.putAll(frameworkScenario.getJavaClassTemplateMap());
+        return result;
+    }
+    
+    /**
+     * Get resource template map.
+     *
+     * @return resource template map
+     */
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>();
+        result.putAll(featureScenario.getResourceTemplateMap());
+        result.putAll(frameworkScenario.getResourceTemplateMap());
+        result.put("resources/logback.ftl", "logback.xml");
+        return result;
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/FeatureExampleScenario.java
similarity index 67%
copy from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
copy to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/FeatureExampleScenario.java
index f2140e1..80f9a73 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/FeatureExampleScenario.java
@@ -15,23 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.example.generator;
+package org.apache.shardingsphere.example.generator.scenario.feature;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.example.generator.scenario.ExampleScenario;
 
 /**
- * Feature type.
+ * Example feature scenario.
  */
-@RequiredArgsConstructor
-@Getter
-public enum FeatureType {
-    
-    SHARDING("sharding"),
-    ENCRYPT("encrypt"),
-    READWRITE_SPLITTING("readwrite-splitting"),
-    SHADOW("shadow"),
-    DB_DISCOVERY("db-discovery");
-    
-    private final String feature;
+public interface FeatureExampleScenario extends ExampleScenario {
 }
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/EncryptExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/EncryptExampleScenario.java
new file mode 100644
index 0000000..7e50e61
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/EncryptExampleScenario.java
@@ -0,0 +1,48 @@
+/*
+ * 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.example.generator.scenario.feature.type;
+
+import org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Encrypt example scenario.
+ */
+public final class EncryptExampleScenario implements FeatureExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>();
+        result.put("java/TestQueryAssistedShardingEncryptAlgorithm.ftl", "TestQueryAssistedShardingEncryptAlgorithm.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>();
+        result.put("resources/spi/encryptAlgorithm.ftl", "META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm");
+        return result;
+    }
+    
+    @Override
+    public String getType() {
+        return "encrypt";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ReadwriteSplittingExampleScenario.java
similarity index 54%
copy from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
copy to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ReadwriteSplittingExampleScenario.java
index f2140e1..2d46f07 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ReadwriteSplittingExampleScenario.java
@@ -15,23 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.example.generator;
+package org.apache.shardingsphere.example.generator.scenario.feature.type;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario;
+
+import java.util.Collections;
+import java.util.Map;
 
 /**
- * Feature type.
+ * Readwrite-splitting example scenario.
  */
-@RequiredArgsConstructor
-@Getter
-public enum FeatureType {
+public final class ReadwriteSplittingExampleScenario implements FeatureExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        return Collections.emptyMap();
+    }
     
-    SHARDING("sharding"),
-    ENCRYPT("encrypt"),
-    READWRITE_SPLITTING("readwrite-splitting"),
-    SHADOW("shadow"),
-    DB_DISCOVERY("db-discovery");
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        return Collections.emptyMap();
+    }
     
-    private final String feature;
+    @Override
+    public String getType() {
+        return "readwrite-splitting";
+    }
 }
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ShadowExampleScenario.java
similarity index 56%
copy from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
copy to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ShadowExampleScenario.java
index f2140e1..d506905 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ShadowExampleScenario.java
@@ -15,23 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.example.generator;
+package org.apache.shardingsphere.example.generator.scenario.feature.type;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario;
+
+import java.util.Collections;
+import java.util.Map;
 
 /**
- * Feature type.
+ * Shadow example scenario.
  */
-@RequiredArgsConstructor
-@Getter
-public enum FeatureType {
+public final class ShadowExampleScenario implements FeatureExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        return Collections.emptyMap();
+    }
     
-    SHARDING("sharding"),
-    ENCRYPT("encrypt"),
-    READWRITE_SPLITTING("readwrite-splitting"),
-    SHADOW("shadow"),
-    DB_DISCOVERY("db-discovery");
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        return Collections.emptyMap();
+    }
     
-    private final String feature;
+    @Override
+    public String getType() {
+        return "shadow";
+    }
 }
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ShardingExampleScenario.java
similarity index 56%
copy from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
copy to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ShardingExampleScenario.java
index f2140e1..eca67fd 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/feature/type/ShardingExampleScenario.java
@@ -15,23 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.example.generator;
+package org.apache.shardingsphere.example.generator.scenario.feature.type;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario;
+
+import java.util.Collections;
+import java.util.Map;
 
 /**
- * Feature type.
+ * Sharding example scenario.
  */
-@RequiredArgsConstructor
-@Getter
-public enum FeatureType {
+public final class ShardingExampleScenario implements FeatureExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        return Collections.emptyMap();
+    }
     
-    SHARDING("sharding"),
-    ENCRYPT("encrypt"),
-    READWRITE_SPLITTING("readwrite-splitting"),
-    SHADOW("shadow"),
-    DB_DISCOVERY("db-discovery");
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        return Collections.emptyMap();
+    }
     
-    private final String feature;
+    @Override
+    public String getType() {
+        return "sharding";
+    }
 }
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/FrameworkExampleScenario.java
similarity index 67%
rename from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
rename to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/FrameworkExampleScenario.java
index f2140e1..b6d855f 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/FeatureType.java
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/FrameworkExampleScenario.java
@@ -15,23 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.example.generator;
+package org.apache.shardingsphere.example.generator.scenario.framework;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.example.generator.scenario.ExampleScenario;
 
 /**
- * Feature type.
+ * Framework example scenario.
  */
-@RequiredArgsConstructor
-@Getter
-public enum FeatureType {
-    
-    SHARDING("sharding"),
-    ENCRYPT("encrypt"),
-    READWRITE_SPLITTING("readwrite-splitting"),
-    SHADOW("shadow"),
-    DB_DISCOVERY("db-discovery");
-    
-    private final String feature;
+public interface FrameworkExampleScenario extends ExampleScenario {
 }
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/JDBCExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/JDBCExampleScenario.java
new file mode 100644
index 0000000..d32c606
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/JDBCExampleScenario.java
@@ -0,0 +1,50 @@
+/*
+ * 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.example.generator.scenario.framework.type;
+
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * JDBC example scenario.
+ */
+public final class JDBCExampleScenario implements FrameworkExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>(4, 1);
+        result.put("java/config/Configuration.ftl", "Configuration.java");
+        result.put("java/repository/jdbc/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
+        result.put("java/repository/jdbc/OrderRepository.ftl", "repository/OrderRepository.java");
+        result.put("java/repository/jdbc/AddressRepository.ftl", "repository/AddressRepository.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        return Collections.emptyMap();
+    }
+    
+    @Override
+    public String getType() {
+        return "jdbc";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJdbcExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJdbcExampleScenario.java
new file mode 100644
index 0000000..345d14d
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJdbcExampleScenario.java
@@ -0,0 +1,50 @@
+/*
+ * 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.example.generator.scenario.framework.type;
+
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Spring-Boot starter JDBC example scenario.
+ */
+public final class SpringBootStarterJdbcExampleScenario implements FrameworkExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>(3, 1);
+        result.put("java/repository/jdbc/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
+        result.put("java/repository/jdbc/OrderRepository.ftl", "repository/OrderRepository.java");
+        result.put("java/repository/jdbc/AddressRepository.ftl", "repository/AddressRepository.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>(1, 1);
+        result.put("resources/properties/application.ftl", "application.properties");
+        return result;
+    }
+    
+    @Override
+    public String getType() {
+        return "spring-boot-starter-jdbc";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJpaExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJpaExampleScenario.java
new file mode 100644
index 0000000..2b3434c
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJpaExampleScenario.java
@@ -0,0 +1,50 @@
+/*
+ * 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.example.generator.scenario.framework.type;
+
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Spring-Boot starter JPA example scenario.
+ */
+public final class SpringBootStarterJpaExampleScenario implements FrameworkExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>(3, 1);
+        result.put("java/repository/jpa/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
+        result.put("java/repository/jpa/OrderRepository.ftl", "repository/OrderRepository.java");
+        result.put("java/repository/jpa/AddressRepository.ftl", "repository/AddressRepository.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>(1, 1);
+        result.put("resources/properties/application.ftl", "application.properties");
+        return result;
+    }
+    
+    @Override
+    public String getType() {
+        return "spring-boot-starter-jpa";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterMyBatisExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterMyBatisExampleScenario.java
new file mode 100644
index 0000000..7f88d21
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterMyBatisExampleScenario.java
@@ -0,0 +1,53 @@
+/*
+ * 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.example.generator.scenario.framework.type;
+
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Spring-Boot starter MyBatis example scenario.
+ */
+public final class SpringBootStarterMyBatisExampleScenario implements FrameworkExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>(3, 1);
+        result.put("java/repository/mybatis/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
+        result.put("java/repository/mybatis/OrderRepository.ftl", "repository/OrderRepository.java");
+        result.put("java/repository/mybatis/AddressRepository.ftl", "repository/AddressRepository.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>(4, 1);
+        result.put("resources/properties/application.ftl", "application.properties");
+        result.put("resources/mappers/OrderItemMapper.ftl", "mappers/OrderItemMapper.xml");
+        result.put("resources/mappers/OrderMapper.ftl", "mappers/OrderMapper.xml");
+        result.put("resources/mappers/AddressMapper.ftl", "mappers/AddressMapper.xml");
+        return result;
+    }
+    
+    @Override
+    public String getType() {
+        return "spring-boot-starter-mybatis";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJdbcExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJdbcExampleScenario.java
new file mode 100644
index 0000000..9542403
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJdbcExampleScenario.java
@@ -0,0 +1,50 @@
+/*
+ * 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.example.generator.scenario.framework.type;
+
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Spring namespace JDBC example scenario.
+ */
+public final class SpringNamespaceJdbcExampleScenario implements FrameworkExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>(3, 1);
+        result.put("java/repository/jdbc/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
+        result.put("java/repository/jdbc/OrderRepository.ftl", "repository/OrderRepository.java");
+        result.put("java/repository/jdbc/AddressRepository.ftl", "repository/AddressRepository.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>(1, 1);
+        result.put("resources/xml/application.ftl", "application.xml");
+        return result;
+    }
+    
+    @Override
+    public String getType() {
+        return "spring-namespace-jdbc";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJpaExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJpaExampleScenario.java
new file mode 100644
index 0000000..8db04bf
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJpaExampleScenario.java
@@ -0,0 +1,50 @@
+/*
+ * 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.example.generator.scenario.framework.type;
+
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Spring namespace JPA example scenario.
+ */
+public final class SpringNamespaceJpaExampleScenario implements FrameworkExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>(3, 1);
+        result.put("java/repository/jpa/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
+        result.put("java/repository/jpa/OrderRepository.ftl", "repository/OrderRepository.java");
+        result.put("java/repository/jpa/AddressRepository.ftl", "repository/AddressRepository.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>(1, 1);
+        result.put("resources/xml/application.ftl", "application.xml");
+        return result;
+    }
+    
+    @Override
+    public String getType() {
+        return "spring-namespace-jpa";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceMyBatisExampleScenario.java b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceMyBatisExampleScenario.java
new file mode 100644
index 0000000..7d75cb8
--- /dev/null
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceMyBatisExampleScenario.java
@@ -0,0 +1,53 @@
+/*
+ * 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.example.generator.scenario.framework.type;
+
+import org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Spring namespace MyBatis example scenario.
+ */
+public final class SpringNamespaceMyBatisExampleScenario implements FrameworkExampleScenario {
+    
+    @Override
+    public Map<String, String> getJavaClassTemplateMap() {
+        Map<String, String> result = new HashMap<>(3, 1);
+        result.put("java/repository/mybatis/OrderItemRepository.ftl", "repository/OrderItemRepository.java");
+        result.put("java/repository/mybatis/OrderRepository.ftl", "repository/OrderRepository.java");
+        result.put("java/repository/mybatis/AddressRepository.ftl", "repository/AddressRepository.java");
+        return result;
+    }
+    
+    @Override
+    public Map<String, String> getResourceTemplateMap() {
+        Map<String, String> result = new HashMap<>(1, 1);
+        result.put("resources/xml/application.ftl", "application.xml");
+        result.put("resources/mappers/OrderItemMapper.ftl", "mappers/OrderItemMapper.xml");
+        result.put("resources/mappers/OrderMapper.ftl", "mappers/OrderMapper.xml");
+        result.put("resources/mappers/AddressMapper.ftl", "mappers/AddressMapper.xml");
+        return result;
+    }
+    
+    @Override
+    public String getType() {
+        return "spring-namespace-mybatis";
+    }
+}
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario
similarity index 68%
copy from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml
copy to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario
index 232792c..32ed897 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.feature.FeatureExampleScenario
@@ -15,12 +15,7 @@
 # limitations under the License.
 #
 
-mode: memory
-transaction: local
-feature: sharding,readwrite-splitting,encrypt
-framework: jdbc
-
-host: localhost
-port: 3306
-username: root
-password: root
+org.apache.shardingsphere.example.generator.scenario.feature.type.ShardingExampleScenario
+org.apache.shardingsphere.example.generator.scenario.feature.type.ReadwriteSplittingExampleScenario
+org.apache.shardingsphere.example.generator.scenario.feature.type.EncryptExampleScenario
+org.apache.shardingsphere.example.generator.scenario.feature.type.ShadowExampleScenario
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario
similarity index 52%
copy from examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml
copy to examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario
index 232792c..bc9fedc 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/META-INF/services/org.apache.shardingsphere.example.generator.scenario.framework.FrameworkExampleScenario
@@ -15,12 +15,10 @@
 # limitations under the License.
 #
 
-mode: memory
-transaction: local
-feature: sharding,readwrite-splitting,encrypt
-framework: jdbc
-
-host: localhost
-port: 3306
-username: root
-password: root
+org.apache.shardingsphere.example.generator.scenario.framework.type.JDBCExampleScenario
+org.apache.shardingsphere.example.generator.scenario.framework.type.SpringBootStarterJdbcExampleScenario
+org.apache.shardingsphere.example.generator.scenario.framework.type.SpringBootStarterJpaExampleScenario
+org.apache.shardingsphere.example.generator.scenario.framework.type.SpringBootStarterMyBatisExampleScenario
+org.apache.shardingsphere.example.generator.scenario.framework.type.SpringNamespaceJdbcExampleScenario
+org.apache.shardingsphere.example.generator.scenario.framework.type.SpringNamespaceJpaExampleScenario
+org.apache.shardingsphere.example.generator.scenario.framework.type.SpringNamespaceMyBatisExampleScenario
diff --git a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml
index 232792c..b270ac7 100644
--- a/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml
+++ b/examples/shardingsphere-sample/shardingsphere-example-generator/src/main/resources/data-model/data-model.yaml
@@ -17,7 +17,8 @@
 
 mode: memory
 transaction: local
-feature: sharding,readwrite-splitting,encrypt
+#feature: sharding,readwrite-splitting,encrypt
+feature: readwrite-splitting
 framework: jdbc
 
 host: localhost