-
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.
支持dubbo2.x、dubbo3.x ,并结合zookeeper、nacos
- Loading branch information
Zhengjiaao
committed
Jun 28, 2022
1 parent
fef152a
commit 30c0782
Showing
44 changed files
with
1,181 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,20 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.zja</groupId> | ||
<artifactId>spring-boot-starter-test-root</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>starter-dubbo2x</module> | ||
<module>starter-dubbo3x</module> | ||
</modules> | ||
|
||
</project> |
Empty file.
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,54 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>starter-dubbo2x-api</module> | ||
<module>starter-dubbo2x-na-consumer</module> | ||
<module>starter-dubbo2x-na-provider</module> | ||
</modules> | ||
|
||
<properties> | ||
<dubbo.version>2.7.15</dubbo.version> | ||
<!--注意,需要是1.4.2 ,参考:dubbo-dependencies-bom中 nacos-client --> | ||
<nacos.version>1.4.2</nacos.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<!--spring-boot-dependencies--> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-dependencies</artifactId> | ||
<version>${spring-boot-dependencies.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
||
<!-- Apache Dubbo --> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo-dependencies-bom</artifactId> | ||
<version>${dubbo.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>${dubbo.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</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
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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x-api</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
13 changes: 13 additions & 0 deletions
13
...ubbo/starter-dubbo2x/starter-dubbo2x-api/src/main/java/com/zja/dubbo/api/DemoService.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 @@ | ||
/** | ||
* @Company: 上海数慧系统技术有限公司 | ||
* @Department: 数据中心 | ||
* @Author: 郑家骜[ào] | ||
* @Email: [email protected] | ||
* @Date: 2022-06-27 13:55 | ||
* @Since: | ||
*/ | ||
package com.zja.dubbo.api; | ||
|
||
public interface DemoService { | ||
String sayHello(String name); | ||
} |
43 changes: 43 additions & 0 deletions
43
starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-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,43 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x-na-consumer</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Dubbo Spring Boot Starter --> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo-spring-boot-starter</artifactId> | ||
<version>${dubbo.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x-api</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
21 changes: 21 additions & 0 deletions
21
...starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/Dubbo2xNAConsumerApplication.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,21 @@ | ||
/** | ||
* @Company: 上海数慧系统技术有限公司 | ||
* @Department: 数据中心 | ||
* @Author: 郑家骜[ào] | ||
* @Email: [email protected] | ||
* @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); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...bo2x/starter-dubbo2x-na-consumer/src/main/java/com/zja/dubbo/consumer/DemoController.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,32 @@ | ||
/** | ||
* @Company: 上海数慧系统技术有限公司 | ||
* @Department: 数据中心 | ||
* @Author: 郑家骜[ào] | ||
* @Email: [email protected] | ||
* @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("李四")); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...ter-dubbo/starter-dubbo2x/starter-dubbo2x-na-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 @@ | ||
server: | ||
port: 8081 | ||
servlet: | ||
context-path: /consumer | ||
spring: | ||
application: | ||
name: dubbo-auto-configuration-consumer | ||
|
44 changes: 44 additions & 0 deletions
44
starter-dubbo/starter-dubbo2x/starter-dubbo2x-na-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,44 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x-na-provider</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Dubbo Spring Boot Starter --> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo-spring-boot-starter</artifactId> | ||
<version>${dubbo.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo2x-api</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
21 changes: 21 additions & 0 deletions
21
...starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/Dubbo2xNAProviderApplication.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,21 @@ | ||
/** | ||
* @Company: 上海数慧系统技术有限公司 | ||
* @Department: 数据中心 | ||
* @Author: 郑家骜[ào] | ||
* @Email: [email protected] | ||
* @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); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...o2x/starter-dubbo2x-na-provider/src/main/java/com/zja/dubbo/provider/DemoServiceImpl.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,20 @@ | ||
/** | ||
* @Company: 上海数慧系统技术有限公司 | ||
* @Department: 数据中心 | ||
* @Author: 郑家骜[ào] | ||
* @Email: [email protected] | ||
* @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 接口成功!"; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ter-dubbo/starter-dubbo2x/starter-dubbo2x-na-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,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 # 无需注册到服务注册中心 |
Empty file.
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,58 @@ | ||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>com.zja</groupId> | ||
<artifactId>starter-dubbo3x</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>starter-dubbo3x-api</module> | ||
<module>starter-dubbo3x-na-consumer</module> | ||
<module>starter-dubbo3x-na-provider</module> | ||
<module>starter-dubbo3x-nacos-consumer</module> | ||
<module>starter-dubbo3x-nacos-provider</module> | ||
<module>starter-dubbo3x-zookeeper-consumer</module> | ||
<module>starter-dubbo3x-zookeeper-provider</module> | ||
</modules> | ||
|
||
<properties> | ||
<dubbo.version>3.0.9</dubbo.version> | ||
<!--注意,需要大于2.1.0--> | ||
<nacos.version>2.1.0</nacos.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<!--spring-boot-dependencies--> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-dependencies</artifactId> | ||
<version>${spring-boot-dependencies.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
||
<!-- Apache Dubbo --> | ||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo-dependencies-bom</artifactId> | ||
<version>${dubbo.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.dubbo</groupId> | ||
<artifactId>dubbo</artifactId> | ||
<version>${dubbo.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
Oops, something went wrong.