forked from yudaocode/SpringBoot-Labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YunaiV
committed
Mar 21, 2020
1 parent
a6ecdf1
commit 24ce2e0
Showing
14 changed files
with
260 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
lab-40/lab-40-zipkin-dubbo/lab-40-zipkin-dubbo-api/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>lab-40-zipkin-dubbo</artifactId> | ||
<groupId>cn.iocoder.springboot.labs</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>lab-40-zipkin-dubbo-api</artifactId> | ||
|
||
|
||
</project> |
16 changes: 16 additions & 0 deletions
16
...ipkin-dubbo-api/src/main/java/cn/iocoder/springboot/lab40/zipkindemo/api/UserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package cn.iocoder.springboot.lab40.zipkindemo.api; | ||
|
||
/** | ||
* 用户服务 RPC Service 接口 | ||
*/ | ||
public interface UserService { | ||
|
||
/** | ||
* 根据指定用户编号,获得用户信息 | ||
* | ||
* @param id 用户编号 | ||
* @return 用户信息 | ||
*/ | ||
String get(Integer id); | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
...0-zipkin-dubbo-api/src/main/java/cn/iocoder/springboot/lab40/zipkindemo/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package cn.iocoder.springcloud.labx13; |
55 changes: 55 additions & 0 deletions
55
lab-40/lab-40-zipkin-dubbo/lab-40-zipkin-dubbo-consumer/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.2.2.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>lab-40-zipkin-dubbo-consumer</artifactId> | ||
|
||
<dependencies> | ||
<!-- 引入定义的 Dubbo API 接口 --> | ||
<dependency> | ||
<groupId>cn.iocoder.springboot.labs</groupId> | ||
<artifactId>lab-40-zipkin-dubbo-api</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<!-- 引入 SpringMVC 相关依赖,并实现对其的自动配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- 实现对 Dubbo 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>2.7.4.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo-spring-boot-starter</artifactId> | ||
<version>2.7.4.1</version> | ||
</dependency> | ||
|
||
<!-- 使用 Zookeeper 作为注册中心 --> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-framework</artifactId> | ||
<version>2.13.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-recipes</artifactId> | ||
<version>2.13.0</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
...src/main/java/cn/iocoder/springboot/lab40/zpkindemo/consumerdemo/ConsumerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cn.iocoder.springboot.lab40.zpkindemo.consumerdemo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class ConsumerApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ConsumerApplication.class); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
...in/java/cn/iocoder/springboot/lab40/zpkindemo/consumerdemo/controller/UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cn.iocoder.springboot.lab40.zpkindemo.consumerdemo.controller; | ||
|
||
import cn.iocoder.springboot.lab40.zipkindemo.api.UserService; | ||
import org.apache.dubbo.config.annotation.Reference; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/user") | ||
public class UserController { | ||
|
||
@Reference(protocol = "dubbo", version = "1.0.0") | ||
private UserService userService; | ||
|
||
@GetMapping("/get") | ||
public String get(@RequestParam("id") Integer id) { | ||
return userService.get(id); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
lab-40/lab-40-zipkin-dubbo/lab-40-zipkin-dubbo-consumer/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# dubbo 配置项,对应 DubboConfigurationProperties 配置类 | ||
dubbo: | ||
# Dubbo 应用配置 | ||
application: | ||
name: user-service-consumer # 应用名 | ||
# Dubbo 注册中心配置 | ||
registry: | ||
address: zookeeper://127.0.0.1:2181 # 注册中心地址。个鞥多注册中心,可见 http://dubbo.apache.org/zh-cn/docs/user/references/registry/introduction.html 文档。 |
55 changes: 55 additions & 0 deletions
55
lab-40/lab-40-zipkin-dubbo/lab-40-zipkin-dubbo-provider/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.2.2.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>lab-40-zipkin-dubbo-provider</artifactId> | ||
|
||
<dependencies> | ||
<!-- 引入定义的 Dubbo API 接口 --> | ||
<dependency> | ||
<groupId>cn.iocoder.springboot.labs</groupId> | ||
<artifactId>lab-40-zipkin-dubbo-api</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<!-- 引入 Spring Boot 依赖 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
|
||
<!-- 实现对 Dubbo 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>2.7.4.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo-spring-boot-starter</artifactId> | ||
<version>2.7.4.1</version> | ||
</dependency> | ||
|
||
<!-- 使用 Zookeeper 作为注册中心 --> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-framework</artifactId> | ||
<version>2.13.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-recipes</artifactId> | ||
<version>2.13.0</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
13 changes: 13 additions & 0 deletions
13
...rc/main/java/cn/iocoder/springboot/lab40/zipkindemo/providerdemo/ProviderApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cn.iocoder.springboot.lab40.zipkindemo.providerdemo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class ProviderApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ProviderApplication.class); | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...ain/java/cn/iocoder/springboot/lab40/zipkindemo/providerdemo/service/UserServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cn.iocoder.springboot.lab40.zipkindemo.providerdemo.service; | ||
|
||
import cn.iocoder.springboot.lab40.zipkindemo.api.UserService; | ||
|
||
@org.apache.dubbo.config.annotation.Service(version = "1.0.0") | ||
public class UserServiceImpl implements UserService { | ||
|
||
@Override | ||
public String get(Integer id) { | ||
return "user:" + id; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
lab-40/lab-40-zipkin-dubbo/lab-40-zipkin-dubbo-provider/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# dubbo 配置项,对应 DubboConfigurationProperties 配置类 | ||
dubbo: | ||
# Dubbo 应用配置 | ||
application: | ||
name: user-service-provider # 应用名 | ||
# Dubbo 注册中心配 | ||
registry: | ||
address: zookeeper://127.0.0.1:2181 # 注册中心地址。个鞥多注册中心,可见 http://dubbo.apache.org/zh-cn/docs/user/references/registry/introduction.html 文档。 | ||
# Dubbo 服务提供者协议配置 | ||
protocol: | ||
port: -1 # 协议端口。使用 -1 表示随机端口。 | ||
name: dubbo # 使用 `dubbo://` 协议。更多协议,可见 http://dubbo.apache.org/zh-cn/docs/user/references/protocol/introduction.html 文档 | ||
# 配置扫描 Dubbo 自定义的 @Service 注解,暴露成 Dubbo 服务提供者 | ||
scan: | ||
base-packages: cn.iocoder.springboot.lab40.zipkindemo.providerdemo.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>labx-13</artifactId> | ||
<groupId>cn.iocoder.springboot.labs</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>lab-40-zipkin-dubbo</artifactId> | ||
<packaging>pom</packaging> | ||
<modules> | ||
<module>lab-40-zipkin-dubbo-api</module> | ||
<module>lab-40-zipkin-dubbo-provider</module> | ||
<module>lab-40-zipkin-dubbo-consumer</module> | ||
</modules> | ||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters