From 5962c950edf32629637cce231294b64396d2a292 Mon Sep 17 00:00:00 2001 From: "Yangkai.Shen" <237497819@qq.com> Date: Wed, 26 Dec 2018 11:22:33 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20spring-boot-demo-dubbo-consumer=20?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spring-boot-demo-dubbo-consumer/README.md | 140 ++++++++++++++++++ .../spring-boot-demo-dubbo-consumer/pom.xml | 4 + 2 files changed, 144 insertions(+) diff --git a/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/README.md b/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/README.md index e69de29..9754771 100644 --- a/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/README.md +++ b/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/README.md @@ -0,0 +1,140 @@ +# spring-boot-demo-dubbo-consumer + +> 此 module 主要是服务调用方的示例 + +## pom.xml + +```xml + + + + spring-boot-demo-dubbo + com.xkcoding + 1.0.0-SNAPSHOT + + 4.0.0 + + spring-boot-demo-dubbo-consumer + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + com.alibaba.spring.boot + dubbo-spring-boot-starter + ${dubbo.starter.version} + + + + ${project.groupId} + spring-boot-demo-dubbo-common + ${project.version} + + + + com.101tec + zkclient + ${zkclient.version} + + + + org.projectlombok + lombok + true + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + spring-boot-demo-dubbo-consumer + + + +``` + +## application.yml + +```yaml +server: + port: 8080 + servlet: + context-path: /demo + +spring: + dubbo: + application: + name: spring-boot-demo-dubbo-consumer + registry: zookeeper://127.0.0.1:2181 +``` + +## SpringBootDemoDubboConsumerApplication.java + +```java +/** + *

+ * 启动器 + *

+ * + * @package: com.xkcoding.dubbo.consumer + * @description: 启动器 + * @author: yangkai.shen + * @date: Created in 2018-12-25 16:49 + * @copyright: Copyright (c) 2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@SpringBootApplication +@EnableDubboConfiguration +public class SpringBootDemoDubboConsumerApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootDemoDubboConsumerApplication.class, args); + } +} +``` + +## HelloController.java + +```java +/** + *

+ * Hello服务API + *

+ * + * @package: com.xkcoding.dubbo.consumer.controller + * @description: Hello服务API + * @author: yangkai.shen + * @date: Created in 2018-12-25 17:22 + * @copyright: Copyright (c) 2018 + * @version: V1.0 + * @modified: yangkai.shen + */ +@RestController +@Slf4j +public class HelloController { + @Reference + private HelloService helloService; + + @GetMapping("/sayHello") + public String sayHello(@RequestParam(defaultValue = "xkcoding") String name) { + log.info("i'm ready to call someone......"); + return helloService.sayHello(name); + } +} +``` \ No newline at end of file diff --git a/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/pom.xml b/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/pom.xml index ab0189d..b001f6b 100644 --- a/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/pom.xml +++ b/spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/pom.xml @@ -54,4 +54,8 @@ + + spring-boot-demo-dubbo-consumer + + \ No newline at end of file