From 30c0782b167c4893cf11405c471db56dfeeeb77f Mon Sep 17 00:00:00 2001 From: Zhengjiaao Date: Tue, 28 Jun 2022 14:06:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(*)=20=E6=96=B0=E5=A2=9E-starter-dubbo?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持dubbo2.x、dubbo3.x ,并结合zookeeper、nacos --- starter-dubbo/README.md | 0 starter-dubbo/pom.xml | 20 ++++++ starter-dubbo/starter-dubbo2x/README.md | 0 starter-dubbo/starter-dubbo2x/pom.xml | 54 +++++++++++++++ .../starter-dubbo2x-api/pom.xml | 21 ++++++ .../java/com/zja/dubbo/api/DemoService.java | 13 ++++ .../starter-dubbo2x-na-consumer/pom.xml | 43 ++++++++++++ .../dubbo/Dubbo2xNAConsumerApplication.java | 21 ++++++ .../zja/dubbo/consumer/DemoController.java | 32 +++++++++ .../src/main/resources/application.yaml | 8 +++ .../starter-dubbo2x-na-provider/pom.xml | 44 ++++++++++++ .../dubbo/Dubbo2xNAProviderApplication.java | 21 ++++++ .../zja/dubbo/provider/DemoServiceImpl.java | 20 ++++++ .../src/main/resources/application.yaml | 16 +++++ starter-dubbo/starter-dubbo3x/README.md | 0 starter-dubbo/starter-dubbo3x/pom.xml | 58 ++++++++++++++++ .../starter-dubbo3x-api/pom.xml | 21 ++++++ .../java/com/zja/dubbo/api/DemoService.java | 13 ++++ .../starter-dubbo3x-na-consumer/pom.xml | 43 ++++++++++++ .../dubbo/Dubbo3xNAConsumerApplication.java | 21 ++++++ .../zja/dubbo/consumer/DemoController.java | 32 +++++++++ .../src/main/resources/application.yaml | 8 +++ .../starter-dubbo3x-na-provider/pom.xml | 44 ++++++++++++ .../dubbo/Dubbo3xNAProviderApplication.java | 23 +++++++ .../zja/dubbo/provider/DemoServiceImpl.java | 20 ++++++ .../src/main/resources/application.yaml | 16 +++++ .../src/main/resources/dubbo/provider.xml | 0 .../starter-dubbo3x-nacos-consumer/pom.xml | 61 +++++++++++++++++ .../Dubbo3xNacosConsumerApplication.java | 21 ++++++ .../dubbo/nacos/consumer/DemoController.java | 32 +++++++++ .../src/main/resources/application.yaml | 24 +++++++ .../starter-dubbo3x-nacos-provider/pom.xml | 67 +++++++++++++++++++ .../Dubbo3xNacosProviderApplication.java | 23 +++++++ .../dubbo/nacos/provider/DemoServiceImpl.java | 21 ++++++ .../src/main/resources/application.yaml | 38 +++++++++++ .../src/main/resources/backup/bootstrap.yaml | 31 +++++++++ .../pom.xml | 57 ++++++++++++++++ .../Dubbo3xZookeeperConsumerApplication.java | 21 ++++++ .../zookeeper/consumer/DemoController.java | 32 +++++++++ .../src/main/resources/application.yaml | 19 ++++++ .../pom.xml | 57 ++++++++++++++++ .../Dubbo3xZookeeperProviderApplication.java | 21 ++++++ .../zookeeper/provider/DemoServiceImpl.java | 20 ++++++ .../src/main/resources/application.yaml | 24 +++++++ 44 files changed, 1181 insertions(+) create mode 100644 starter-dubbo/README.md create mode 100644 starter-dubbo/pom.xml create mode 100644 starter-dubbo/starter-dubbo2x/README.md create mode 100644 starter-dubbo/starter-dubbo2x/pom.xml create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/pom.xml create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/src/main/java/com/zja/dubbo/api/DemoService.java create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/pom.xml create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/Dubbo2xNAConsumerApplication.java create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/resources/application.yaml create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/pom.xml create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/Dubbo2xNAProviderApplication.java create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java create mode 100644 starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/resources/application.yaml create mode 100644 starter-dubbo/starter-dubbo3x/README.md create mode 100644 starter-dubbo/starter-dubbo3x/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/src/main/java/com/zja/dubbo/api/DemoService.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/Dubbo3xNAConsumerApplication.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/resources/application.yaml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/Dubbo3xNAProviderApplication.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/resources/application.yaml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/resources/dubbo/provider.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosConsumerApplication.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/consumer/DemoController.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/resources/application.yaml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosProviderApplication.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/provider/DemoServiceImpl.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/application.yaml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/backup/bootstrap.yaml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperConsumerApplication.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/consumer/DemoController.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/resources/application.yaml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/pom.xml create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperProviderApplication.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/provider/DemoServiceImpl.java create mode 100644 starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/resources/application.yaml diff --git a/starter-dubbo/README.md b/starter-dubbo/README.md new file mode 100644 index 0000000..e69de29 diff --git a/starter-dubbo/pom.xml b/starter-dubbo/pom.xml new file mode 100644 index 0000000..13ea2e5 --- /dev/null +++ b/starter-dubbo/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.zja + spring-boot-starter-test-root + 2.0-SNAPSHOT + + + com.zja + starter-dubbo + pom + + + starter-dubbo2x + starter-dubbo3x + + + diff --git a/starter-dubbo/starter-dubbo2x/README.md b/starter-dubbo/starter-dubbo2x/README.md new file mode 100644 index 0000000..e69de29 diff --git a/starter-dubbo/starter-dubbo2x/pom.xml b/starter-dubbo/starter-dubbo2x/pom.xml new file mode 100644 index 0000000..b2ef143 --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + com.zja + starter-dubbo + 2.0-SNAPSHOT + + + com.zja + starter-dubbo2x + pom + + + starter-dubbo2x-api + starter-dubbo2x-na-consumer + starter-dubbo2x-na-provider + + + + 2.7.15 + + 1.4.2 + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot-dependencies.version} + pom + import + + + + + org.apache.dubbo + dubbo-dependencies-bom + ${dubbo.version} + pom + import + + + + org.apache.dubbo + dubbo + ${dubbo.version} + + + + diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/pom.xml b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/pom.xml new file mode 100644 index 0000000..9883714 --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.zja + starter-dubbo2x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo2x-api + jar + + + + org.projectlombok + lombok + + + diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/src/main/java/com/zja/dubbo/api/DemoService.java b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/src/main/java/com/zja/dubbo/api/DemoService.java new file mode 100644 index 0000000..657e19f --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-api/src/main/java/com/zja/dubbo/api/DemoService.java @@ -0,0 +1,13 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 13:55 + * @Since: + */ +package com.zja.dubbo.api; + +public interface DemoService { + String sayHello(String name); +} diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/pom.xml b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/pom.xml new file mode 100644 index 0000000..8d62dda --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + com.zja + starter-dubbo2x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo2x-na-consumer + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + org.apache.dubbo + dubbo + + + com.zja + starter-dubbo2x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/Dubbo2xNAConsumerApplication.java b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/Dubbo2xNAConsumerApplication.java new file mode 100644 index 0000000..0aade0a --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/Dubbo2xNAConsumerApplication.java @@ -0,0 +1,21 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-28 13:13 + * @Since: + */ +package com.zja.dubbo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Dubbo2xNAConsumerApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo2xNAConsumerApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java new file mode 100644 index 0000000..9b28805 --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java @@ -0,0 +1,32 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 14:00 + * @Since: + */ +package com.zja.dubbo.consumer; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/dubbo") +public class DemoController { + + @DubboReference(version = "1.0.0", url = "dubbo://127.0.0.1:12345") + DemoService demoService; + + /** + * http://localhost:8081/consumer/dubbo/sayHello + */ + @GetMapping("/sayHello") + public ResponseEntity queryById() { + return ResponseEntity.ok(demoService.sayHello("李四")); + } +} diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/resources/application.yaml new file mode 100644 index 0000000..8d22c1f --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-consumer/src/main/resources/application.yaml @@ -0,0 +1,8 @@ +server: + port: 8081 + servlet: + context-path: /consumer +spring: + application: + name: dubbo-auto-configuration-consumer + diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/pom.xml b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/pom.xml new file mode 100644 index 0000000..6bc038f --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + com.zja + starter-dubbo2x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo2x-na-provider + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + org.apache.dubbo + dubbo + + + + com.zja + starter-dubbo2x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/Dubbo2xNAProviderApplication.java b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/Dubbo2xNAProviderApplication.java new file mode 100644 index 0000000..dc32d01 --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/Dubbo2xNAProviderApplication.java @@ -0,0 +1,21 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-28 13:13 + * @Since: + */ +package com.zja.dubbo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Dubbo2xNAProviderApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo2xNAProviderApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java new file mode 100644 index 0000000..2c999bd --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java @@ -0,0 +1,20 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 13:56 + * @Since: + */ +package com.zja.dubbo.provider; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboService; + +@DubboService(version = "1.0.0") +public class DemoServiceImpl implements DemoService { + @Override + public String sayHello(String name) { + return name + " 你好,您调用 DUBBO RPC 接口成功!"; + } +} diff --git a/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/resources/application.yaml new file mode 100644 index 0000000..19b9348 --- /dev/null +++ b/starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-provider/src/main/resources/application.yaml @@ -0,0 +1,16 @@ +server: + port: 8082 + servlet: + context-path: /provider +spring: + application: + name: dubbo-auto-configuration-provider + +dubbo: + scan: + base-packages: com.zja.dubbo.provider + protocol: + name: dubbo + port: 12345 + registry: + address: N/A # 无需注册到服务注册中心 diff --git a/starter-dubbo/starter-dubbo3x/README.md b/starter-dubbo/starter-dubbo3x/README.md new file mode 100644 index 0000000..e69de29 diff --git a/starter-dubbo/starter-dubbo3x/pom.xml b/starter-dubbo/starter-dubbo3x/pom.xml new file mode 100644 index 0000000..b104933 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + com.zja + starter-dubbo + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x + pom + + + starter-dubbo3x-api + starter-dubbo3x-na-consumer + starter-dubbo3x-na-provider + starter-dubbo3x-nacos-consumer + starter-dubbo3x-nacos-provider + starter-dubbo3x-zookeeper-consumer + starter-dubbo3x-zookeeper-provider + + + + 3.0.9 + + 2.1.0 + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot-dependencies.version} + pom + import + + + + + org.apache.dubbo + dubbo-dependencies-bom + ${dubbo.version} + pom + import + + + + org.apache.dubbo + dubbo + ${dubbo.version} + + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/pom.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/pom.xml new file mode 100644 index 0000000..d8c7f29 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.zja + starter-dubbo3x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x-api + jar + + + + org.projectlombok + lombok + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/src/main/java/com/zja/dubbo/api/DemoService.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/src/main/java/com/zja/dubbo/api/DemoService.java new file mode 100644 index 0000000..657e19f --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-api/src/main/java/com/zja/dubbo/api/DemoService.java @@ -0,0 +1,13 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 13:55 + * @Since: + */ +package com.zja.dubbo.api; + +public interface DemoService { + String sayHello(String name); +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/pom.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/pom.xml new file mode 100644 index 0000000..5a47a48 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + com.zja + starter-dubbo3x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x-na-consumer + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + org.apache.dubbo + dubbo + + + com.zja + starter-dubbo3x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/Dubbo3xNAConsumerApplication.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/Dubbo3xNAConsumerApplication.java new file mode 100644 index 0000000..1ab80ee --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/Dubbo3xNAConsumerApplication.java @@ -0,0 +1,21 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 14:50 + * @Since: + */ +package com.zja.dubbo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Dubbo3xNAConsumerApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo3xNAConsumerApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java new file mode 100644 index 0000000..9b28805 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.java @@ -0,0 +1,32 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 14:00 + * @Since: + */ +package com.zja.dubbo.consumer; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/dubbo") +public class DemoController { + + @DubboReference(version = "1.0.0", url = "dubbo://127.0.0.1:12345") + DemoService demoService; + + /** + * http://localhost:8081/consumer/dubbo/sayHello + */ + @GetMapping("/sayHello") + public ResponseEntity queryById() { + return ResponseEntity.ok(demoService.sayHello("李四")); + } +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/resources/application.yaml new file mode 100644 index 0000000..8d22c1f --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-consumer/src/main/resources/application.yaml @@ -0,0 +1,8 @@ +server: + port: 8081 + servlet: + context-path: /consumer +spring: + application: + name: dubbo-auto-configuration-consumer + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/pom.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/pom.xml new file mode 100644 index 0000000..da5bc75 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + com.zja + starter-dubbo3x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x-na-provider + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + org.apache.dubbo + dubbo + + + + com.zja + starter-dubbo3x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/Dubbo3xNAProviderApplication.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/Dubbo3xNAProviderApplication.java new file mode 100644 index 0000000..d3783ff --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/Dubbo3xNAProviderApplication.java @@ -0,0 +1,23 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 14:49 + * @Since: + */ +package com.zja.dubbo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +//@EnableDubbo // 默认启用 +//@ImportResource(value={"classpath:dubbo/provider.xml"}) +@SpringBootApplication +public class Dubbo3xNAProviderApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo3xNAProviderApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java new file mode 100644 index 0000000..2c999bd --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.java @@ -0,0 +1,20 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 13:56 + * @Since: + */ +package com.zja.dubbo.provider; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboService; + +@DubboService(version = "1.0.0") +public class DemoServiceImpl implements DemoService { + @Override + public String sayHello(String name) { + return name + " 你好,您调用 DUBBO RPC 接口成功!"; + } +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/resources/application.yaml new file mode 100644 index 0000000..19b9348 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/resources/application.yaml @@ -0,0 +1,16 @@ +server: + port: 8082 + servlet: + context-path: /provider +spring: + application: + name: dubbo-auto-configuration-provider + +dubbo: + scan: + base-packages: com.zja.dubbo.provider + protocol: + name: dubbo + port: 12345 + registry: + address: N/A # 无需注册到服务注册中心 diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/resources/dubbo/provider.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-na-provider/src/main/resources/dubbo/provider.xml new file mode 100644 index 0000000..e69de29 diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/pom.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/pom.xml new file mode 100644 index 0000000..41cbafa --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.zja + starter-dubbo3x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x-nacos-consumer + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + + org.apache.dubbo + dubbo + ${dubbo.version} + + + + org.apache.dubbo + dubbo-registry-nacos + ${dubbo.version} + + + + + + + + + com.zja + starter-dubbo3x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosConsumerApplication.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosConsumerApplication.java new file mode 100644 index 0000000..9944eee --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosConsumerApplication.java @@ -0,0 +1,21 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 16:01 + * @Since: + */ +package com.zja.dubbo.nacos; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Dubbo3xNacosConsumerApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo3xNacosConsumerApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/consumer/DemoController.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/consumer/DemoController.java new file mode 100644 index 0000000..53bead1 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/java/com/zja/dubbo/nacos/consumer/DemoController.java @@ -0,0 +1,32 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 14:00 + * @Since: + */ +package com.zja.dubbo.nacos.consumer; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/dubbo") +public class DemoController { + + @DubboReference(version = "${demo.service.version}") + DemoService demoService; + + /** + * http://localhost:8086/consumer/dubbo/sayHello + */ + @GetMapping("/sayHello") + public ResponseEntity queryById() { + return ResponseEntity.ok(demoService.sayHello("李四")); + } +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/resources/application.yaml new file mode 100644 index 0000000..17b948b --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-consumer/src/main/resources/application.yaml @@ -0,0 +1,24 @@ +server: + port: 8086 + servlet: + context-path: /consumer + +spring: + application: + name: dubbo-nacos-consumer + +nacos: + host: 192.168.159.1 + port: 8848 + username: nacos + password: nacos + +dubbo: + registry: + address: nacos://${nacos.host}:${nacos.port} + provider: + register: false # 默true,消费端不需要注册的情况设置未false + +demo: + service: + version: 1.0.0 diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/pom.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/pom.xml new file mode 100644 index 0000000..1748a9c --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + com.zja + starter-dubbo3x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x-nacos-provider + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + + org.apache.dubbo + dubbo + ${dubbo.version} + + + + org.apache.dubbo + dubbo-registry-nacos + ${dubbo.version} + + + + + + + com.alibaba.nacos + nacos-client + 2.1.0 + + + + com.zja + starter-dubbo3x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosProviderApplication.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosProviderApplication.java new file mode 100644 index 0000000..f832d0d --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/Dubbo3xNacosProviderApplication.java @@ -0,0 +1,23 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 16:01 + * @Since: + */ +package com.zja.dubbo.nacos; + +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@EnableDubbo(scanBasePackages = {"com.zja.dubbo.nacos.provider"}) +@SpringBootApplication +public class Dubbo3xNacosProviderApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo3xNacosProviderApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/provider/DemoServiceImpl.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/provider/DemoServiceImpl.java new file mode 100644 index 0000000..d02b45d --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/java/com/zja/dubbo/nacos/provider/DemoServiceImpl.java @@ -0,0 +1,21 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 13:56 + * @Since: + */ +package com.zja.dubbo.nacos.provider; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboService; + +@DubboService(version = "${demo.service.version}") +//@DubboService(version = "${demo.service.version}", group = "demo") +public class DemoServiceImpl implements DemoService { + @Override + public String sayHello(String name) { + return name + " 你好,您调用 DUBBO RPC 接口成功!"; + } +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/application.yaml new file mode 100644 index 0000000..eb5efc3 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/application.yaml @@ -0,0 +1,38 @@ +server: + port: 8087 + servlet: + context-path: /provider + +spring: + application: + name: dubbo-nacos-provider + main: + allow-bean-definition-overriding: true + +nacos: + host: 192.168.159.1 + port: 8848 + username: nacos + password: nacos + +dubbo: + application: + name: ${spring.application.name} # 默 ${spring.application.name} + scan: + base-packages: com.zja.dubbo.nacos.provider + protocol: + name: dubbo # Dubbo Protocol + port: 20883 # Random port + registry: + # nacos开启了权限认证 + # address: nacos://${nacos.host}:${nacos.port}?username=${nacos.username}&password=${nacos.password}&namespace=public + #nacos 未开启权限认证 + address: nacos://${nacos.host}:${nacos.port} + #parameters: + # namespace: public # nacos 命名空间 + #显示在nacos配置列表中 参考:https://github.com/apache/dubbo/issues/7116 + use-as-metadata-center: false # 默 true,地址是否作为远程元数据中心, + use-as-config-center: false # 默 true,地址是否作为配置中心 +demo: + service: + version: 1.0.0 diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/backup/bootstrap.yaml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/backup/bootstrap.yaml new file mode 100644 index 0000000..7b1235e --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-nacos-provider/src/main/resources/backup/bootstrap.yaml @@ -0,0 +1,31 @@ +server: + port: 8087 +spring: + profiles: + active: dev + application: + name: dubbo-nacos-provider + main: + allow-bean-definition-overriding: true +# cloud: +# nacos: +# discovery: +# server-addr: 192.168.14.22:30001 +# namespace: public + +dubbo: + registry: + address: nacos://192.168.14.22:30001 + # parameters: + # namespace: @nacos.namespace@ # 可选-命名空间 +# scan: +# base-packages: com.zja.dubbo.nacos.provider + protocol: + name: dubbo + port: 4001 +# provider: +# filter: dubboExceptionFilter,-exception # 自定义过滤器 + +demo: + service: + version: 1.0.0 diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/pom.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/pom.xml new file mode 100644 index 0000000..07d1dc7 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + com.zja + starter-dubbo3x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x-zookeeper-consumer + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + + + org.apache.zookeeper + zookeeper + + + org.slf4j + slf4j-log4j12 + + + + + + org.apache.curator + curator-x-discovery + + + + com.zja + starter-dubbo3x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperConsumerApplication.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperConsumerApplication.java new file mode 100644 index 0000000..3516e32 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperConsumerApplication.java @@ -0,0 +1,21 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 15:42 + * @Since: + */ +package com.zja.dubbo.zookeeper; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Dubbo3xZookeeperConsumerApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo3xZookeeperConsumerApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/consumer/DemoController.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/consumer/DemoController.java new file mode 100644 index 0000000..33351d6 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/java/com/zja/dubbo/zookeeper/consumer/DemoController.java @@ -0,0 +1,32 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 14:00 + * @Since: + */ +package com.zja.dubbo.zookeeper.consumer; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/dubbo") +public class DemoController { + + @DubboReference(version = "${demo.service.version}") + DemoService demoService; + + /** + * http://localhost:8086/consumer/dubbo/sayHello + */ + @GetMapping("/sayHello") + public ResponseEntity queryById() { + return ResponseEntity.ok(demoService.sayHello("李四")); + } +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/resources/application.yaml new file mode 100644 index 0000000..6be8e23 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-consumer/src/main/resources/application.yaml @@ -0,0 +1,19 @@ +server: + port: 8086 + servlet: + context-path: /consumer + +spring: + application: + name: dubbo-zookeeper-consumer + +dubbo: + application: + metadata-type: composite + registry: + address: zookeeper://127.0.0.1:2181?registry-type=service + file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache + +demo: + service: + version: 1.0.0 diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/pom.xml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/pom.xml new file mode 100644 index 0000000..d55032f --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + com.zja + starter-dubbo3x + 2.0-SNAPSHOT + + + com.zja + starter-dubbo3x-zookeeper-provider + jar + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + + + org.apache.zookeeper + zookeeper + + + org.slf4j + slf4j-log4j12 + + + + + + org.apache.curator + curator-x-discovery + + + + com.zja + starter-dubbo3x-api + 2.0-SNAPSHOT + compile + + + diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperProviderApplication.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperProviderApplication.java new file mode 100644 index 0000000..0065bce --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/Dubbo3xZookeeperProviderApplication.java @@ -0,0 +1,21 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 15:42 + * @Since: + */ +package com.zja.dubbo.zookeeper; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Dubbo3xZookeeperProviderApplication { + + public static void main(String[] args) { + SpringApplication.run(Dubbo3xZookeeperProviderApplication.class, args); + } + +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/provider/DemoServiceImpl.java b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/provider/DemoServiceImpl.java new file mode 100644 index 0000000..e882536 --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/java/com/zja/dubbo/zookeeper/provider/DemoServiceImpl.java @@ -0,0 +1,20 @@ +/** + * @Company: 上海数慧系统技术有限公司 + * @Department: 数据中心 + * @Author: 郑家骜[ào] + * @Email: zhengja@dist.com.cn + * @Date: 2022-06-27 13:56 + * @Since: + */ +package com.zja.dubbo.zookeeper.provider; + +import com.zja.dubbo.api.DemoService; +import org.apache.dubbo.config.annotation.DubboService; + +@DubboService(version = "${demo.service.version}") +public class DemoServiceImpl implements DemoService { + @Override + public String sayHello(String name) { + return name + " 你好,您调用 DUBBO RPC 接口成功!"; + } +} diff --git a/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/resources/application.yaml b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/resources/application.yaml new file mode 100644 index 0000000..409c07b --- /dev/null +++ b/starter-dubbo/starter-dubbo3x/starter-dubbo3x-zookeeper-provider/src/main/resources/application.yaml @@ -0,0 +1,24 @@ +server: + port: 8087 + servlet: + context-path: /provider + +spring: + application: + name: dubbo-zookeeper-provider + +dubbo: + application: + name: ${spring.application.name} # 默 ${spring.application.name} + metadata-type: composite # 默 local, 元数据类型 + scan: + base-packages: com.zja.dubbo.zookeeper.provider + protocol: + name: dubbo # Dubbo Protocol + port: -1 # Random port + registry: + address: zookeeper://127.0.0.1:2181?registry-type=service + +demo: + service: + version: 1.0.0