This is an automated email from the ASF dual-hosted git repository. totalo 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 8811c4e77bc Update example template to use `ShardingSphereDriver` (#22683) 8811c4e77bc is described below commit 8811c4e77bc9896351f09970b085b54a55dae05d Author: Raigor <raigor.ji...@gmail.com> AuthorDate: Tue Dec 6 10:09:59 2022 +0800 Update example template to use `ShardingSphereDriver` (#22683) * Update example template to use `ShardingSphereDriver` * Add blank line. --- examples/pom.xml | 10 -- .../type/SpringBootStarterJdbcExampleScenario.java | 5 +- .../type/SpringBootStarterJpaExampleScenario.java | 5 +- .../SpringBootStarterMyBatisExampleScenario.java | 3 +- .../type/SpringNamespaceJdbcExampleScenario.java | 5 +- .../type/SpringNamespaceJpaExampleScenario.java | 5 +- .../SpringNamespaceMyBatisExampleScenario.java | 1 + .../src/main/resources/template/jdbc/pom.ftl | 36 +------ .../mode/spring-namespace/config/cluster-etcd.ftl | 23 ---- .../spring-namespace/config/cluster-zookeeper.ftl | 23 ---- .../resources/mode/spring-namespace/standalone.ftl | 17 --- .../jdbc/resources/properties/application.ftl | 49 +-------- .../jdbc/resources/properties/db-discovery.ftl | 24 ----- .../template/jdbc/resources/properties/encrypt.ftl | 30 ------ .../resources/properties/readwrite-splitting.ftl | 21 ---- .../template/jdbc/resources/properties/shadow.ftl | 45 -------- .../jdbc/resources/properties/sharding.ftl | 49 --------- .../template/jdbc/resources/xml/application.ftl | 116 ++------------------- .../template/jdbc/resources/xml/db-discovery.ftl | 32 ------ .../template/jdbc/resources/xml/encrypt.ftl | 32 ------ .../jdbc/resources/xml/readwrite-splitting.ftl | 24 ----- .../template/jdbc/resources/xml/shadow.ftl | 63 ----------- .../template/jdbc/resources/xml/sharding.ftl | 54 ---------- .../template/jdbc/resources/yaml/config.ftl | 62 +++++++++++ .../feature/db-discovery.ftl} | 23 +++- .../standalone.ftl => yaml/feature/encrypt.ftl} | 23 +++- .../feature/readwrite-splitting.ftl} | 17 ++- .../cluster-etcd.ftl => yaml/feature/shadow.ftl} | 30 +++++- .../jdbc/resources/yaml/feature/sharding.ftl | 69 ++++++++++++ .../cluster.ftl => yaml/mode/cluster-etcd.ftl} | 9 +- .../mode/cluster-zookeeper.ftl} | 8 +- .../xa-narayana.ftl => yaml/mode/standalone.ftl} | 7 +- .../sql-parse/sql-parse.ftl} | 3 +- .../transaction/xa-atomikos.ftl | 5 +- .../transaction/xa-bitronix.ftl | 5 +- .../transaction/xa-narayana.ftl | 5 +- 36 files changed, 272 insertions(+), 666 deletions(-) diff --git a/examples/pom.xml b/examples/pom.xml index 0b4a6c6ae26..5b0c88afb3a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -122,16 +122,6 @@ <artifactId>shardingsphere-transaction-base-seata-at</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-jdbc-core-spring-namespace</artifactId> - <version>${project.version}</version> - </dependency> <dependency> <groupId>org.apache.shardingsphere</groupId> <artifactId>shardingsphere-cluster-mode-repository-zookeeper</artifactId> diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJdbcExampleScenario.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJdbcExampleScenario.java index 812eb1b3b10..144b4bc14b1 100644 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJdbcExampleScenario.java +++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJdbcExampleScenario.java @@ -41,7 +41,10 @@ public final class SpringBootStarterJdbcExampleScenario implements FrameworkExam @Override public Map<String, String> getResourceTemplateMap() { - return Collections.singletonMap("resources/properties/application.ftl", "application.properties"); + Map<String, String> result = new HashMap<>(2, 1); + result.put("resources/properties/application.ftl", "application.properties"); + result.put("resources/yaml/config.ftl", "config.yaml"); + return result; } @Override diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJpaExampleScenario.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJpaExampleScenario.java index bd29497a2db..c7141761836 100644 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJpaExampleScenario.java +++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterJpaExampleScenario.java @@ -41,7 +41,10 @@ public final class SpringBootStarterJpaExampleScenario implements FrameworkExamp @Override public Map<String, String> getResourceTemplateMap() { - return Collections.singletonMap("resources/properties/application.ftl", "application.properties"); + Map<String, String> result = new HashMap<>(2, 1); + result.put("resources/properties/application.ftl", "application.properties"); + result.put("resources/yaml/config.ftl", "config.yaml"); + return result; } @Override diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterMyBatisExampleScenario.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterMyBatisExampleScenario.java index 5513d3dd498..5cf69065639 100644 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterMyBatisExampleScenario.java +++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringBootStarterMyBatisExampleScenario.java @@ -41,8 +41,9 @@ public final class SpringBootStarterMyBatisExampleScenario implements FrameworkE @Override public Map<String, String> getResourceTemplateMap() { - Map<String, String> result = new HashMap<>(4, 1); + Map<String, String> result = new HashMap<>(5, 1); result.put("resources/properties/application.ftl", "application.properties"); + result.put("resources/yaml/config.ftl", "config.yaml"); 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"); diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJdbcExampleScenario.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJdbcExampleScenario.java index 39cfade0e50..ed7225ee1fd 100644 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJdbcExampleScenario.java +++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJdbcExampleScenario.java @@ -41,7 +41,10 @@ public final class SpringNamespaceJdbcExampleScenario implements FrameworkExampl @Override public Map<String, String> getResourceTemplateMap() { - return Collections.singletonMap("resources/xml/application.ftl", "application.xml"); + Map<String, String> result = new HashMap<>(2, 1); + result.put("resources/xml/application.ftl", "application.xml"); + result.put("resources/yaml/config.ftl", "config.yaml"); + return result; } @Override diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJpaExampleScenario.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJpaExampleScenario.java index 9e3ba642ec4..e4d99874257 100644 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJpaExampleScenario.java +++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceJpaExampleScenario.java @@ -41,7 +41,10 @@ public final class SpringNamespaceJpaExampleScenario implements FrameworkExample @Override public Map<String, String> getResourceTemplateMap() { - return Collections.singletonMap("resources/xml/application.ftl", "application.xml"); + Map<String, String> result = new HashMap<>(2, 1); + result.put("resources/xml/application.ftl", "application.xml"); + result.put("resources/yaml/config.ftl", "config.yaml"); + return result; } @Override diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceMyBatisExampleScenario.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceMyBatisExampleScenario.java index 4adad5462c7..1ead20159a1 100644 --- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceMyBatisExampleScenario.java +++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/scenario/framework/type/SpringNamespaceMyBatisExampleScenario.java @@ -43,6 +43,7 @@ public final class SpringNamespaceMyBatisExampleScenario implements FrameworkExa public Map<String, String> getResourceTemplateMap() { Map<String, String> result = new HashMap<>(4, 1); result.put("resources/xml/application.ftl", "application.xml"); + result.put("resources/yaml/config.ftl", "config.yaml"); 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"); diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl index 5ccdf1b185b..c51408f5ce3 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl @@ -26,20 +26,11 @@ <name>${r'${project.artifactId}'}</name> <dependencies> - <#if framework=="jdbc"> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-jdbc-core</artifactId> - <version>${r'${project.version}'}</version> - </dependency> - </#if> - <#if framework?contains("spring-namespace")> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-jdbc-core-spring-namespace</artifactId> - <version>${r'${project.version}'}</version> - </dependency> - </#if> + <dependency> + <groupId>org.apache.shardingsphere</groupId> + <artifactId>shardingsphere-jdbc-core</artifactId> + <version>${r'${project.version}'}</version> + </dependency> <#if transaction?contains("xa")> <dependency> <groupId>org.apache.shardingsphere</groupId> @@ -124,18 +115,6 @@ </dependency> </#if> <#if framework?contains("spring-boot-starter")> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId> - <version>${r'${project.version}'}</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot</artifactId> @@ -146,11 +125,6 @@ <artifactId>spring-boot-autoconfigure</artifactId> <version>2.2.0.RELEASE</version> </dependency> - <dependency> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - <version>1.33</version> - </dependency> </#if> <#if framework=="spring-boot-starter-jdbc"> <dependency> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/cluster-etcd.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/cluster-etcd.ftl deleted file mode 100644 index d44ea073964..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/cluster-etcd.ftl +++ /dev/null @@ -1,23 +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. - --> - -<cluster:repository id="clusterRepository" type="etcd" namespace="generator_demo" server-lists="localhost:2379"> - <props> - <prop key="max-retries">3</prop> - <prop key="operation-timeout-milliseconds">1000</prop> - </props> -</cluster:repository> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/cluster-zookeeper.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/cluster-zookeeper.ftl deleted file mode 100644 index 85e0a8fbe1a..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/cluster-zookeeper.ftl +++ /dev/null @@ -1,23 +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. - --> - -<cluster:repository id="clusterRepository" type="Zookeeper" namespace="generator_demo" server-lists="localhost:2181"> - <props> - <prop key="max-retries">3</prop> - <prop key="operation-timeout-milliseconds">1000</prop> - </props> -</cluster:repository> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/standalone.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/standalone.ftl deleted file mode 100644 index b932a0b459c..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/standalone.ftl +++ /dev/null @@ -1,17 +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. - --> -<shardingsphere:mode type="Standalone" repository-ref="standaloneRepository" /> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/application.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/application.ftl index 8383c9cb791..23924509970 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/application.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/application.ftl @@ -14,57 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. # -<#if mode?exists> - <#include "../mode/spring-boot-starter/${mode}.ftl" /> -</#if> -<#if transaction!="local" && transaction!="base-seata"> - <#include "./transaction/${transaction}.ftl" /> -</#if> -<#if framework?contains("mybatis")> +<#if framework?contains("mybatis")> mybatis.mapper-locations=classpath*:mappers/*Mapper.xml <#elseif framework?contains("jpa")> - spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect spring.jpa.properties.hibernate.show_sql=false </#if> -<#assign datasourceStr="ds-0"> -<#if feature!="encrypt"> - <#assign datasourceStr += ",ds-1" /> - <#if feature!="shadow"> - <#assign datasourceStr += ",ds-2" /> - </#if> -</#if> -spring.shardingsphere.datasource.names=${datasourceStr} - -spring.shardingsphere.datasource.ds-0.type=com.zaxxer.hikari.HikariDataSource -spring.shardingsphere.datasource.ds-0.driver-class-name=com.mysql.cj.jdbc.Driver -spring.shardingsphere.datasource.ds-0.jdbc-url=jdbc:mysql://${host}:${port}/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true -spring.shardingsphere.datasource.ds-0.username=${username} -spring.shardingsphere.datasource.ds-0.password=${(password)?string} -spring.shardingsphere.datasource.ds-0.max-active=16 - -<#if feature!="encrypt"> -spring.shardingsphere.datasource.ds-1.type=com.zaxxer.hikari.HikariDataSource -spring.shardingsphere.datasource.ds-1.driver-class-name=com.mysql.cj.jdbc.Driver -spring.shardingsphere.datasource.ds-1.jdbc-url=jdbc:mysql://${host}:${port}/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true -spring.shardingsphere.datasource.ds-1.username=${username} -spring.shardingsphere.datasource.ds-1.password=${(password)?string} -spring.shardingsphere.datasource.ds-1.max-active=16 - -<#if feature!="shadow"> -spring.shardingsphere.datasource.ds-2.type=com.zaxxer.hikari.HikariDataSource -spring.shardingsphere.datasource.ds-2.driver-class-name=com.mysql.cj.jdbc.Driver -spring.shardingsphere.datasource.ds-2.jdbc-url=jdbc:mysql://${host}:${port}/demo_ds_2?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true -spring.shardingsphere.datasource.ds-2.username=${username} -spring.shardingsphere.datasource.ds-2.password=${(password)?string} -spring.shardingsphere.datasource.ds-2.max-active=16 -</#if> -</#if> -<#list feature?split(",") as item> - <#include "${item}.ftl"> -</#list> - -spring.shardingsphere.props.sql-show=true +spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver +spring.datasource.url=jdbc:shardingsphere:classpath:config.yaml diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/db-discovery.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/db-discovery.ftl deleted file mode 100644 index 1a0ae258889..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/db-discovery.ftl +++ /dev/null @@ -1,24 +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. - --> - -spring.shardingsphere.rules.database-discovery.data-sources.rule.data-source-names=ds-0,ds-1,ds-2 -spring.shardingsphere.rules.database-discovery.data-sources.rule.discovery-heartbeat-name=mgr-heartbeat -spring.shardingsphere.rules.database-discovery.data-sources.rule.discovery-type-name=mgr -spring.shardingsphere.rules.database-discovery.discovery-heartbeats.mgr-heartbeat.props.keep-alive-cron=0/5 * * * * ? -spring.shardingsphere.rules.database-discovery.discovery-types.mgr.type=MySQL.MGR -spring.shardingsphere.rules.database-discovery.discovery-types.mgr.props.keep-alive-cron=0/5 * * * * ? -spring.shardingsphere.rules.database-discovery.discovery-types.mgr.props.group-name=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/encrypt.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/encrypt.ftl deleted file mode 100644 index e7368e76a86..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/encrypt.ftl +++ /dev/null @@ -1,30 +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. - --> - -spring.shardingsphere.rules.encrypt.encryptors.phone-encryptor.type=AES -spring.shardingsphere.rules.encrypt.encryptors.phone-encryptor.props.aes-key-value=123456 - -spring.shardingsphere.rules.encrypt.encryptors.string_encryptor.type=assistedTest - -spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.cipher-column=status -spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.assisted-query-column=assisted_query_status -spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.encryptor-name=string_encryptor -spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.assisted-query-encryptor-name=string_encryptor - -spring.shardingsphere.rules.encrypt.tables.t_order_item.columns.phone.cipher-column=phone -spring.shardingsphere.rules.encrypt.tables.t_order_item.columns.phone.plain-column=phone_plain -spring.shardingsphere.rules.encrypt.tables.t_order_item.columns.phone.encryptor-name=phone-encryptor diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/readwrite-splitting.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/readwrite-splitting.ftl deleted file mode 100644 index 06b067b2b77..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/readwrite-splitting.ftl +++ /dev/null @@ -1,21 +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. - --> - -spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.static-strategy.write-data-source-name=ds-0 -spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.static-strategy.read-data-source-names=ds-1,ds-2 -spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.load-balancer-name=round_robin -spring.shardingsphere.rules.readwrite-splitting.load-balancers.round_robin.type=ROUND_ROBIN diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/shadow.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/shadow.ftl deleted file mode 100644 index ac3d28339e1..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/shadow.ftl +++ /dev/null @@ -1,45 +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. - --> - -spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.production-data-source-name=ds-0 -spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.shadow-data-source-name=ds-1 - -spring.shardingsphere.rules.shadow.default-shadow-algorithm-name=simple-hint-algorithm - -spring.shardingsphere.rules.shadow.tables.t_order.data-source-names=shadow-data-source -spring.shardingsphere.rules.shadow.tables.t_order.shadow-algorithm-names=user-id-insert-match-algorithm,user-id-delete-match-algorithm,user-id-select-match-algorithm,simple-hint-algorithm - -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.type=VALUE_MATCH -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.props.operation=insert -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.props.column=order_type -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-match-algorithm.props.value=1 - -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.type=VALUE_MATCH -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.props.operation=delete -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.props.column=order_type -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-delete-match-algorithm.props.value=1 - -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.type=VALUE_MATCH -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.props.operation=select -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.props.column=order_type -spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-select-match-algorithm.props.value=1 - -spring.shardingsphere.rules.shadow.shadow-algorithms.simple-hint-algorithm.type=SIMPLE_HINT -spring.shardingsphere.rules.shadow.shadow-algorithms.simple-hint-algorithm.props.shadow=true -spring.shardingsphere.rules.shadow.shadow-algorithms.simple-hint-algorithm.props.foo=bar - -spring.shardingsphere.rules.sql-parser.sql-comment-parse-enabled=true diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/sharding.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/sharding.ftl deleted file mode 100644 index 6d569798d80..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/sharding.ftl +++ /dev/null @@ -1,49 +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. - --> - -spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=user_id -spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=database-inline - -spring.shardingsphere.rules.sharding.binding-tables=t_order,t_order_item -spring.shardingsphere.rules.sharding.broadcast-tables=t_address - -spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds-$->{0..1}.t_order_$->{0..1} -spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id -spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=t-order-inline - -spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.column=order_id -spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.key-generator-name=snowflake -#spring.shardingsphere.rules.sharding.tables.t_order.audit-strategy.auditor-names=shardingKeyAudit -#spring.shardingsphere.rules.sharding.tables.t_order.audit-strategy.allow-hint-disable=true - -spring.shardingsphere.rules.sharding.tables.t_order_item.actual-data-nodes=ds-$->{0..1}.t_order_item_$->{0..1} -spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-column=order_id -spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-algorithm-name=t-order-item-inline - -spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.column=order_item_id -spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.key-generator-name=snowflake - -spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.type=INLINE -spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.props.algorithm-expression=ds-$->{user_id % 2} -spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.type=INLINE -spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.props.algorithm-expression=t_order_$->{order_id % 2} -spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.type=INLINE -spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.props.algorithm-expression=t_order_item_$->{order_id % 2} - -spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE - -#spring.shardingsphere.rules.sharding.auditors.shardingKeyAudit.type=DML_SHARDING_CONDITIONS diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/application.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/application.ftl index d63bce142e2..55f062b5d88 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/application.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/application.ftl @@ -21,46 +21,23 @@ xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" - xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource" - xmlns:sharding="http://shardingsphere.apache.org/schema/shardingsphere/sharding" - xmlns:readwrite-splitting="http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting" - xmlns:encrypt="http://shardingsphere.apache.org/schema/shardingsphere/encrypt" - xmlns:shadow="http://shardingsphere.apache.org/schema/shardingsphere/shadow" - xmlns:database-discovery="http://shardingsphere.apache.org/schema/shardingsphere/database-discovery" - xmlns:sql-parser="http://shardingsphere.apache.org/schema/shardingsphere/sql-parser" - xmlns:standalone="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone" - xmlns:cluster="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster" 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/datasource - http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd - http://shardingsphere.apache.org/schema/shardingsphere/sharding - http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding.xsd - http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting - http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting/readwrite-splitting.xsd - http://shardingsphere.apache.org/schema/shardingsphere/encrypt - http://shardingsphere.apache.org/schema/shardingsphere/encrypt/encrypt.xsd - http://shardingsphere.apache.org/schema/shardingsphere/shadow - http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow.xsd - http://shardingsphere.apache.org/schema/shardingsphere/database-discovery - http://shardingsphere.apache.org/schema/shardingsphere/database-discovery/database-discovery.xsd - http://shardingsphere.apache.org/schema/shardingsphere/sql-parser - http://shardingsphere.apache.org/schema/shardingsphere/sql-parser/sql-parser.xsd - http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster - http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster/repository.xsd - http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone - http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone/repository.xsd "> <#assign package = feature?replace('-', '')?replace(',', '.') /> - + <context:annotation-config /> <context:component-scan base-package="org.apache.shardingsphere.example.${package}.${framework?replace('-', '.')}"/> -<#if framework=="spring-namespace-jpa"> + <bean id="shardingDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource"> + <property name="driverClass" value="org.apache.shardingsphere.driver.ShardingSphereDriver" /> + <property name="url" value="jdbc:shardingsphere:classpath:config.yaml" /> + </bean> +<#if framework=="spring-namespace-jpa"> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter"> @@ -78,37 +55,6 @@ <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" p:entityManagerFactory-ref="entityManagerFactory" /> <tx:annotation-driven /> </#if> - - <!-- - Notice: If you are using the db-discovery module, please replace the database address with the corresponding database cluster address - --> - - <bean id="ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> - <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/> - <property name="jdbcUrl" value="jdbc:mysql://${host}:${port}/demo_ds_0?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> - <property name="username" value="${username}"/> - <property name="password" value="${(password)?string}"/> - </bean> -<#if feature!="encrypt"> - <bean id="ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> - <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/> - <property name="jdbcUrl" value="jdbc:mysql://${host}:${port}/demo_ds_1?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> - <property name="username" value="${username}"/> - <property name="password" value="${(password)?string}"/> - </bean> - <#if feature!="shadow"> - <bean id="ds_2" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> - <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/> - <property name="jdbcUrl" value="jdbc:mysql://${host}:${port}/demo_ds_2?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> - <property name="username" value="${username}"/> - <property name="password" value="${(password)?string}"/> - </bean> - </#if> -</#if> -<#list feature?split(",") as item> - <#include "${item}.ftl"> -</#list> - <#if framework=="spring-namespace-mybatis"> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> @@ -125,52 +71,4 @@ <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> </bean> </#if> - -<#if mode?exists> - <#include "../mode/spring-namespace/config/${mode}.ftl" /> -</#if> -<#assign ruleRefs=""> -<#list feature?split(",") as item> - <#assign ruleRefs += toCamel(item) + "Rule" /> - <#if item_has_next> - <#assign ruleRefs += ", " /> - </#if> -</#list> -<#if feature?contains("shadow")> - <#assign ruleRefs += ", sqlParseRule" /> -</#if> -<#assign datasourceStr="ds_0"> -<#if feature!="encrypt"> - <#assign datasourceStr += ",ds_1" /> - <#if feature!="shadow"> - <#assign datasourceStr += ",ds_2" /> - </#if> -</#if> - <shardingsphere:data-source id="dataSource" data-source-names="${datasourceStr}" rule-refs="${ruleRefs}"> - <#if mode?contains("cluster")> - <#include "../mode/spring-namespace/cluster.ftl" /> - <#elseif mode?contains("standalone")> - <#include "../mode/spring-namespace/standalone.ftl" /> - </#if> - <props> - <prop key="sql-show">true</prop> - <#if transaction=="xa-atomikos"> - <prop key="xa-transaction-manager-type">Atomikos</prop> - <#elseif transaction=="xa-narayana"> - <prop key="xa-transaction-manager-type">Narayana</prop> - <#elseif transaction=="xa-bitronix"> - <prop key="xa-transaction-manager-type">Bitronix</prop> - </#if> - </props> - </shardingsphere:data-source> -</beans> -<#function toCamel(s)> - <#return s - ?replace('(^-+)|(-+$)', '', 'r') - ?replace('\\-+(\\w)?', ' $1', 'r') - ?replace('([A-Z])', ' $1', 'r') - ?capitalize - ?replace(' ' , '') - ?uncap_first - > -</#function> +</beans> \ No newline at end of file diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/db-discovery.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/db-discovery.ftl deleted file mode 100644 index e50caf34278..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/db-discovery.ftl +++ /dev/null @@ -1,32 +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. - --> - - <database-discovery:rule id="dbDiscoveryRule"> - <database-discovery:data-source-rule id="db" data-source-names="ds_0,ds_1,ds_2" discovery-heartbeat-name="mgr-heartbeat" discovery-type-name="mgr" /> - <database-discovery:discovery-heartbeat id="mgr-heartbeat"> - <props> - <prop key="keep-alive-cron">0/5 * * * * ?</prop> - </props> - </database-discovery:discovery-heartbeat> - </database-discovery:rule> - - <database-discovery:discovery-type id="mgr" type="MySQL.MGR"> - <props> - <prop key="keep-alive-cron">0/5 * * * * ?</prop> - <prop key="group-name">aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa</prop> - </props> - </database-discovery:discovery-type> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/encrypt.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/encrypt.ftl deleted file mode 100644 index 64702f74035..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/encrypt.ftl +++ /dev/null @@ -1,32 +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. - --> - - <encrypt:encrypt-algorithm id="phone_encryptor" type="AES"> - <props> - <prop key="aes-key-value">123456</prop> - </props> - </encrypt:encrypt-algorithm> - <encrypt:encrypt-algorithm id="string_encryptor" type="assistedTest" /> - - <encrypt:rule id="encryptRule"> - <encrypt:table name="t_order"> - <encrypt:column logic-column="status" cipher-column="status" assisted-query-column="assisted_query_status" encrypt-algorithm-ref="string_encryptor" assisted-query-encrypt-algorithm-ref="string_encryptor" /> - </encrypt:table> - <encrypt:table name="t_order_item"> - <encrypt:column logic-column="phone" cipher-column="phone" plain-column="phone_plain" encrypt-algorithm-ref="phone_encryptor" /> - </encrypt:table> - </encrypt:rule> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/readwrite-splitting.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/readwrite-splitting.ftl deleted file mode 100644 index a56cfb002be..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/readwrite-splitting.ftl +++ /dev/null @@ -1,24 +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. - --> - - <readwrite-splitting:load-balance-algorithm id="randomStrategy" type="RANDOM" /> - - <readwrite-splitting:rule id="readwriteSplittingRule"> - <readwrite-splitting:data-source-rule id="demo_ds" load-balance-algorithm-ref="randomStrategy"> - <readwrite-splitting:static-strategy id="staticStrategy" write-data-source-name="ds_0" read-data-source-names="ds_1, ds_2"/> - </readwrite-splitting:data-source-rule> - </readwrite-splitting:rule> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/shadow.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/shadow.ftl deleted file mode 100644 index fdc24ebde25..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/shadow.ftl +++ /dev/null @@ -1,63 +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. - --> - - <shadow:shadow-algorithm id="user-id-insert-match-algorithm" type="VALUE_MATCH"> - <props> - <prop key="operation">insert</prop> - <prop key="column">order_type</prop> - <prop key="value">1</prop> - </props> - </shadow:shadow-algorithm> - - <shadow:shadow-algorithm id="order-type-delete-match-algorithm" type="VALUE_MATCH"> - <props> - <prop key="operation">delete</prop> - <prop key="column">order_type</prop> - <prop key="value">1</prop> - </props> - </shadow:shadow-algorithm> - - <shadow:shadow-algorithm id="order-type-select-match-algorithm" type="VALUE_MATCH"> - <props> - <prop key="operation">select</prop> - <prop key="column">order_type</prop> - <prop key="value">1</prop> - </props> - </shadow:shadow-algorithm> - - <shadow:shadow-algorithm id="simple-hint-algorithm" type="SIMPLE_HINT"> - <props> - <prop key="shadow">true</prop> - <prop key="foo">bar</prop> - </props> - </shadow:shadow-algorithm> - - <shadow:rule id="shadowRule"> - <shadow:data-source id="shadow-data-source" production-data-source-name="ds_0" shadow-data-source-name="ds_1"/> - <shadow:shadow-table name="t_order" data-sources="shadow-data-source"> - <shadow:algorithm shadow-algorithm-ref="order-type-insert-match-algorithm" /> - <shadow:algorithm shadow-algorithm-ref="order-type-delete-match-algorithm" /> - <shadow:algorithm shadow-algorithm-ref="order-type-select-match-algorithm" /> - <shadow:algorithm shadow-algorithm-ref="simple-hint-algorithm" /> - </shadow:shadow-table> - <shadow:default-shadow-algorithm-name name="simple-hint-algorithm"/> - </shadow:rule> - - <sql-parser:rule id="sqlParseRule" sql-comment-parse-enable="true" parse-tree-cache-ref="parserTreeCache" sql-statement-cache-ref="sqlStatementCache" /> - - <sql-parser:cache-option id="sqlStatementCache" initial-capacity="1024" maximum-size="1024"/> - <sql-parser:cache-option id="parserTreeCache" initial-capacity="1024" maximum-size="1024"/> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/sharding.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/sharding.ftl deleted file mode 100644 index 0365a8f5a82..00000000000 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/xml/sharding.ftl +++ /dev/null @@ -1,54 +0,0 @@ -<#-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - - <sharding:sharding-algorithm id="databaseAlgorithm" type="INLINE"> - <props> - <prop key="algorithm-expression">ds_${r'${user_id % 2}'}</prop> - </props> - </sharding:sharding-algorithm> - <sharding:standard-strategy id="databaseStrategy" sharding-column="user_id" algorithm-ref="databaseAlgorithm" /> - - <sharding:key-generate-algorithm id="snowflakeAlgorithm" type="SNOWFLAKE"> - </sharding:key-generate-algorithm> - - <sharding:audit-algorithm id="auditAlgorithm" type="DML_SHARDING_CONDITIONS"> - </sharding:audit-algorithm> - - <sharding:key-generate-strategy id="orderKeyGenerator" column="order_id" algorithm-ref="snowflakeAlgorithm" /> - <sharding:key-generate-strategy id="accountKeyGenerator" column="account_id" algorithm-ref="snowflakeAlgorithm" /> - <sharding:key-generate-strategy id="itemKeyGenerator" column="order_item_id" algorithm-ref="snowflakeAlgorithm" /> - - <sharding:audit-strategy id="shardingKeyAudit" allow-hint-disable="true"> - <sharding:auditors> - <sharding:auditor algorithm-ref="auditAlgorithm" /> - </sharding:auditors> - </sharding:audit-strategy> - - <sharding:rule id="shardingRule"> - <sharding:table-rules> - <!--todo add audit--> - <sharding:table-rule logic-table="t_order" database-strategy-ref="databaseStrategy" key-generate-strategy-ref="orderKeyGenerator" /> - <sharding:table-rule logic-table="t_order_item" database-strategy-ref="databaseStrategy" key-generate-strategy-ref="itemKeyGenerator" /> - <sharding:table-rule logic-table="t_account" database-strategy-ref="databaseStrategy" key-generate-strategy-ref="accountKeyGenerator" /> - </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:rule> diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/config.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/config.ftl new file mode 100644 index 00000000000..8a2ee96716a --- /dev/null +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/config.ftl @@ -0,0 +1,62 @@ +# +# 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. +# +<#if mode?exists> + <#include "./mode/${mode}.ftl" /> +</#if> + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: com.mysql.jdbc.Driver + jdbcUrl: jdbc:mysql://${host}:${port}/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true + username: ${username} + password: ${(password)?string} + maxPoolSize: 10 +<#if feature!="encrypt"> + ds_1: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: com.mysql.jdbc.Driver + jdbcUrl: jdbc:mysql://${host}:${port}/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true + username: ${username} + password: ${(password)?string} + maxPoolSize: 10 +<#if feature!="shadow"> + ds_2: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: com.mysql.jdbc.Driver + jdbcUrl: jdbc:mysql://${host}:${port}/demo_ds_2?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true + username: ${username} + password: ${(password)?string} + maxPoolSize: 10 +</#if> +</#if> + +rules: +<#list feature?split(",") as item> + <#include "./feature/${item}.ftl"> +</#list> + +<#if feature?contains("shadow")> + <#include "./sql-parse/sql-parse.ftl" /> +</#if> + +<#if transaction!="local" && transaction!="base-seata"> + <#include "./transaction/${transaction}.ftl" /> +</#if> + +props: + sql-show: true diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-zookeeper.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/db-discovery.ftl similarity index 65% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-zookeeper.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/db-discovery.ftl index 6ed0621ec16..d653faaec61 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-zookeeper.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/db-discovery.ftl @@ -14,8 +14,21 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - -spring.shardingsphere.mode.type=Cluster -spring.shardingsphere.mode.repository.type=ZooKeeper -spring.shardingsphere.mode.repository.props.namespace=generator_demo -spring.shardingsphere.mode.repository.props.server-lists=localhost:2181 +- !DB_DISCOVERY + dataSources: + group_0: + dataSourceNames: + - ds_0 + - ds_1 + - ds_2 + discoveryHeartbeatName: mgr_heartbeat + discoveryTypeName: mgr_type + discoveryHeartbeats: + mgr_heartbeat: + props: + keep-alive-cron: '0/5 * * * * ?' + discoveryTypes: + mgr_type: + type: MySQL.MGR + props: + group-name: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/standalone.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/encrypt.ftl similarity index 61% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/standalone.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/encrypt.ftl index d3bbbb7bfb5..142bb660f64 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/standalone.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/encrypt.ftl @@ -14,7 +14,24 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> +- !ENCRYPT + tables: + t_order: + columns: + status: + cipherColumn: status + encryptorName: string_encryptor + assistedQueryColumn: assisted_query_status + assistedQueryEncryptorName: string_encryptor + phone: + plainColumn: phone_plain + cipherColumn: phone + encryptorName: phone_encryptor -spring.shardingsphere.mode.type=Standalone -spring.shardingsphere.mode.repository.type=JDBC -spring.shardingsphere.mode.repository.props.path=demo + encryptors: + string_encryptor: + type: assistedTest + phone_encryptor: + type: AES + props: + aes-key-value: 123456 diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-etcd.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/readwrite-splitting.ftl similarity index 74% copy from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-etcd.ftl copy to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/readwrite-splitting.ftl index 9ee8f03a6a0..1d43a377b7a 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-etcd.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/readwrite-splitting.ftl @@ -14,8 +14,15 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - -spring.shardingsphere.mode.type=Cluster -spring.shardingsphere.mode.repository.type=etcd -spring.shardingsphere.mode.repository.props.namespace=generator_demo -spring.shardingsphere.mode.repository.props.server-lists=localhost:2379 +- !READWRITE_SPLITTING + dataSources: + readwrite_ds: + staticStrategy: + writeDataSourceName: ds_0 + readDataSourceNames: + - ds_1 + - ds_2 + loadBalancerName: round_robin + loadBalancers: + round_robin: + type: ROUND_ROBIN diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-etcd.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/shadow.ftl similarity index 57% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-etcd.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/shadow.ftl index 9ee8f03a6a0..26ee05b8027 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-etcd.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/shadow.ftl @@ -14,8 +14,28 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - -spring.shardingsphere.mode.type=Cluster -spring.shardingsphere.mode.repository.type=etcd -spring.shardingsphere.mode.repository.props.namespace=generator_demo -spring.shardingsphere.mode.repository.props.server-lists=localhost:2379 +- !SHADOW + dataSources: + shadow_group: + productionDataSourceName: ds_0 + shadowDataSourceName: ds_1 + tables: + t_order: + dataSourceNames: + - shadow_group + shadowAlgorithmNames: + - user_id_insert_match_algorithm + - simple_hint_algorithm + defaultShadowAlgorithmName: simple-hint-algorithm + shadowAlgorithms: + user_id_insert_match_algorithm: + type: VALUE_MATCH + props: + operation: insert + column: order_type + value: 1 + simple_hint_algorithm: + type: SIMPLE_HINT + props: + shadow: true + foo: bar diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/sharding.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/sharding.ftl new file mode 100644 index 00000000000..d290c4c2015 --- /dev/null +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/feature/sharding.ftl @@ -0,0 +1,69 @@ +<#-- + ~ 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. + --> +- !SHARDING + tables: + t_order: + actualDataNodes: ds_$->{0..1}.t_order_$->{0..1} + tableStrategy: + standard: + shardingColumn: order_id + shardingAlgorithmName: t_order_inline + keyGenerateStrategy: + column: order_id + keyGeneratorName: snowflake_generator + auditStrategy: + auditorNames: + - sharding_key_required_auditor + allowHintDisable: true + t_order_item: + actualDataNodes: ds_$->{0..1}.t_order_item_$->{0..1} + tableStrategy: + standard: + shardingColumn: order_id + shardingAlgorithmName: t_order_item_inline + keyGenerateStrategy: + column: order_item_id + keyGeneratorName: snowflake_generator + bindingTables: + - t_order,t_order_item + broadcastTables: + - t_address + + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: database_inline + + shardingAlgorithms: + database_inline: + type: INLINE + props: + algorithm-expression: ds_$->{user_id % 2} + t_order_inline: + type: INLINE + props: + algorithm-expression: t_order_$->{order_id % 2} + t_order_item_inline: + type: INLINE + props: + algorithm-expression: t_order_item_$->{order_id % 2} + keyGenerators: + snowflake_generator: + type: SNOWFLAKE + auditors: + sharding_key_required_auditor: + type: DML_SHARDING_CONDITIONS diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/cluster.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/cluster-etcd.ftl similarity index 86% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/cluster.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/cluster-etcd.ftl index 619634ce4c1..27bbb82f6e6 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/cluster.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/cluster-etcd.ftl @@ -14,4 +14,11 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<shardingsphere:mode type="Cluster" repository-ref="clusterRepository" /> + +mode: + type: Cluster + repository: + type: etcd + props: + namespace: generator_demo + server-lists: localhost:2379 diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-bitronix.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/cluster-zookeeper.ftl similarity index 85% copy from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-bitronix.ftl copy to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/cluster-zookeeper.ftl index fab0ab427c7..9ea69cf2aad 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-bitronix.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/cluster-zookeeper.ftl @@ -15,4 +15,10 @@ ~ limitations under the License. --> -spring.shardingsphere.props.xa-transaction-manager-type=Bitronix +mode: + type: Cluster + repository: + type: ZooKeeper + props: + namespace: generator_demo + server-lists: localhost:2181 diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-narayana.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/standalone.ftl similarity index 90% copy from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-narayana.ftl copy to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/standalone.ftl index 05e2ed290e0..4a4b4e6c5c3 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-narayana.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/mode/standalone.ftl @@ -15,4 +15,9 @@ ~ limitations under the License. --> -spring.shardingsphere.props.xa-transaction-manager-type=Narayana +mode: + type: Standalone + repository: + type: JDBC + props: + path: demo diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/standalone.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/sql-parse/sql-parse.ftl similarity index 92% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/standalone.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/sql-parse/sql-parse.ftl index 4c601b5ccec..f2ef6e24ea1 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-namespace/config/standalone.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/sql-parse/sql-parse.ftl @@ -14,4 +14,5 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<standalone:repository id="standaloneRepository" type="JDBC" /> +- !SQL_PARSER + sqlCommentParseEnabled: true diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-atomikos.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-atomikos.ftl similarity index 92% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-atomikos.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-atomikos.ftl index 0e4564e5209..acf21f5cf7d 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-atomikos.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-atomikos.ftl @@ -14,5 +14,6 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - -spring.shardingsphere.props.xa-transaction-manager-type=Atomikos +- !TRANSACTION + defaultType: XA + providerType: Atomikos diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-bitronix.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-bitronix.ftl similarity index 92% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-bitronix.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-bitronix.ftl index fab0ab427c7..ed5207a7f93 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-bitronix.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-bitronix.ftl @@ -14,5 +14,6 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - -spring.shardingsphere.props.xa-transaction-manager-type=Bitronix +- !TRANSACTION + defaultType: XA + providerType: Bitronix diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-narayana.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-narayana.ftl similarity index 92% rename from examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-narayana.ftl rename to examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-narayana.ftl index 05e2ed290e0..343279dcffe 100644 --- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/properties/transaction/xa-narayana.ftl +++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/yaml/transaction/xa-narayana.ftl @@ -14,5 +14,6 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - -spring.shardingsphere.props.xa-transaction-manager-type=Narayana +- !TRANSACTION + defaultType: XA + providerType: Narayana