You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/04/18 07:57:46 UTC

[shardingsphere] branch master updated: Add mode support for spring boot starter (#16889)

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

zhaojinchao 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 9d990ce6f56 Add mode support for spring boot starter (#16889)
9d990ce6f56 is described below

commit 9d990ce6f564058c142d51b1a32b76f50de04830
Author: Guocheng Tang <to...@apache.org>
AuthorDate: Mon Apr 18 15:57:38 2022 +0800

    Add mode support for spring boot starter (#16889)
---
 .../mode/spring-boot-starter/cluster-etcd.ftl      | 22 ++++++++++++++++++++++
 .../mode/spring-boot-starter/cluster-zookeeper.ftl | 22 ++++++++++++++++++++++
 .../mode/spring-boot-starter/standalone-file.ftl   | 21 +++++++++++++++++++++
 .../jdbc/resources/properties/application.ftl      |  3 +++
 4 files changed, 68 insertions(+)

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/mode/spring-boot-starter/cluster-etcd.ftl
new file mode 100644
index 00000000000..7fd5356459e
--- /dev/null
+++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-etcd.ftl
@@ -0,0 +1,22 @@
+<#--
+  ~ 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.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
+spring.shardingsphere.mode.overwrite=false
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/mode/spring-boot-starter/cluster-zookeeper.ftl
new file mode 100644
index 00000000000..41d0864b84f
--- /dev/null
+++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/cluster-zookeeper.ftl
@@ -0,0 +1,22 @@
+<#--
+  ~ 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.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
+spring.shardingsphere.mode.overwrite=false
diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/standalone-file.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/standalone-file.ftl
new file mode 100644
index 00000000000..a5e8f7c2b9a
--- /dev/null
+++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/resources/mode/spring-boot-starter/standalone-file.ftl
@@ -0,0 +1,21 @@
+<#--
+  ~ 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.mode.type=Standalone
+spring.shardingsphere.mode.repository.type=file
+spring.shardingsphere.mode.repository.props.path=demo
+spring.shardingsphere.mode.overwrite=false
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 876c9b085b2..8671dd50414 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,6 +14,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+<#if mode!="memory">
+    <#include "mode/spring-boot-starter/${mode}.ftl" />
+</#if>
 <#if framework?contains("mybatis")>
 
 mybatis.mapper-locations=classpath*:mappers/*Mapper.xml