mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Polish : /spring-cloud-incubator/spring-cloud-alibaba#387 : Dubbo Spring Cloud Samples
This commit is contained in:
parent
8e9398d24f
commit
ab1ecca6ab
@ -26,6 +26,7 @@
|
|||||||
<dubbo-spring-boot.version>0.2.1.RELEASE</dubbo-spring-boot.version>
|
<dubbo-spring-boot.version>0.2.1.RELEASE</dubbo-spring-boot.version>
|
||||||
<dubbo-registry-nacos.version>0.0.2</dubbo-registry-nacos.version>
|
<dubbo-registry-nacos.version>0.0.2</dubbo-registry-nacos.version>
|
||||||
<spring-cloud-zookeeper.version>2.1.0.RELEASE</spring-cloud-zookeeper.version>
|
<spring-cloud-zookeeper.version>2.1.0.RELEASE</spring-cloud-zookeeper.version>
|
||||||
|
<spring-cloud-consul.version>2.1.0.RELEASE</spring-cloud-consul.version>
|
||||||
<curator.version>4.0.1</curator.version>
|
<curator.version>4.0.1</curator.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -88,19 +89,45 @@
|
|||||||
<artifactId>spring-cloud-context</artifactId>
|
<artifactId>spring-cloud-context</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dubbo Spring Cloud Starter -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
|
||||||
|
<!-- Nacos -->
|
||||||
|
<profile>
|
||||||
|
<id>nacos</id>
|
||||||
|
<dependencies>
|
||||||
<!-- Nacos Service Discovery -->
|
<!-- Nacos Service Discovery -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>eureka</id>
|
||||||
|
<dependencies>
|
||||||
<!-- Eureka Service Discovery -->
|
<!-- Eureka Service Discovery -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<!-- Zookeeper -->
|
||||||
|
<profile>
|
||||||
|
<id>zookeeper</id>
|
||||||
|
<dependencies>
|
||||||
<!-- Zookeeper Service Discovery -->
|
<!-- Zookeeper Service Discovery -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
@ -134,41 +161,22 @@
|
|||||||
<version>${curator.version}</version>
|
<version>${curator.version}</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Dubbo Spring Cloud Starter -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
</profile>
|
||||||
|
|
||||||
<profiles>
|
|
||||||
|
|
||||||
<!-- Nacos -->
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>nacos</id>
|
<id>consul</id>
|
||||||
<activation>
|
<activation>
|
||||||
<activeByDefault>true</activeByDefault>
|
<activeByDefault>true</activeByDefault>
|
||||||
</activation>
|
</activation>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- Spring Cloud Consul -->
|
||||||
</dependencies>
|
<dependency>
|
||||||
</profile>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
|
||||||
<profile>
|
<version>${spring-cloud-consul.version}</version>
|
||||||
<id>eureka</id>
|
<optional>true</optional>
|
||||||
<dependencies>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</profile>
|
|
||||||
|
|
||||||
<!-- Zookeeper -->
|
|
||||||
<profile>
|
|
||||||
<id>zookeeper</id>
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
@ -130,12 +130,12 @@ public class DubboSpringCloudConsumerBootstrap {
|
|||||||
|
|
||||||
// To call /param
|
// To call /param
|
||||||
callParam();
|
callParam();
|
||||||
//
|
|
||||||
// // To call /params
|
// To call /params
|
||||||
// callParams();
|
callParams();
|
||||||
//
|
|
||||||
// // To call /request/body/map
|
// To call /request/body/map
|
||||||
// callRequestBodyMap();
|
callRequestBodyMap();
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -209,6 +209,7 @@ public class DubboSpringCloudConsumerBootstrap {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new SpringApplicationBuilder(DubboSpringCloudConsumerBootstrap.class)
|
new SpringApplicationBuilder(DubboSpringCloudConsumerBootstrap.class)
|
||||||
|
.profiles("consul")
|
||||||
.run(args);
|
.run(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: spring-cloud-alibaba-dubbo-consumer
|
name: spring-cloud-alibaba-dubbo-consumer
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
# default disable all
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 127.0.0.1:8848
|
enabled: false
|
||||||
config:
|
register-enabled: false
|
||||||
server-addr: 127.0.0.1:8848
|
|
||||||
zookeeper:
|
zookeeper:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
consul:
|
||||||
main:
|
enabled: false
|
||||||
allow-bean-definition-overriding: true
|
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
@ -21,31 +23,45 @@ provider:
|
|||||||
application:
|
application:
|
||||||
name: spring-cloud-alibaba-dubbo-provider
|
name: spring-cloud-alibaba-dubbo-provider
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
spring:
|
spring:
|
||||||
profiles: eureka
|
profiles: nacos
|
||||||
|
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
enabled: false
|
enabled: true
|
||||||
register-enabled: false
|
register-enabled: true
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: eureka
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
enabled: true
|
enabled: true
|
||||||
service-url:
|
service-url:
|
||||||
defaultZone: http://localhost:9090/eureka/
|
defaultZone: http://127.0.0.1:9090/eureka/
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
spring:
|
spring:
|
||||||
profiles: zookeeper
|
profiles: zookeeper
|
||||||
|
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
enabled: false
|
|
||||||
register-enabled: false
|
|
||||||
|
|
||||||
zookeeper:
|
zookeeper:
|
||||||
enabled: true
|
enabled: true
|
||||||
connect-string: localhost:2181
|
connect-string: 127.0.0.1:2181
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: consul
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
consul:
|
||||||
|
enabled: true
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 8500
|
@ -29,6 +29,7 @@ public class DubboSpringCloudProviderBootstrap {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new SpringApplicationBuilder(DubboSpringCloudProviderBootstrap.class)
|
new SpringApplicationBuilder(DubboSpringCloudProviderBootstrap.class)
|
||||||
|
.profiles("consul")
|
||||||
.run(args);
|
.run(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,63 @@
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: spring-cloud-alibaba-dubbo-provider
|
name: spring-cloud-alibaba-dubbo-provider
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
server-addr: 127.0.0.1:8848
|
|
||||||
config:
|
|
||||||
server-addr: 127.0.0.1:8848
|
|
||||||
zookeeper:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
eureka:
|
# default disable all
|
||||||
client:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
---
|
|
||||||
spring:
|
|
||||||
profiles: eureka
|
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
enabled: false
|
enabled: false
|
||||||
register-enabled: false
|
register-enabled: false
|
||||||
|
zookeeper:
|
||||||
|
enabled: false
|
||||||
|
consul:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
eureka:
|
||||||
|
client:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: nacos
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
enabled: true
|
||||||
|
register-enabled: true
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: eureka
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
enabled: true
|
enabled: true
|
||||||
service-url:
|
service-url:
|
||||||
defaultZone: http://localhost:9090/eureka/
|
defaultZone: http://127.0.0.1:9090/eureka/
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
spring:
|
spring:
|
||||||
profiles: zookeeper
|
profiles: zookeeper
|
||||||
|
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
enabled: false
|
|
||||||
register-enabled: false
|
|
||||||
|
|
||||||
zookeeper:
|
zookeeper:
|
||||||
enabled: true
|
enabled: true
|
||||||
connect-string: localhost:2181
|
connect-string: 127.0.0.1:2181
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
profiles: consul
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
consul:
|
||||||
|
enabled: true
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 8500
|
Loading…
x
Reference in New Issue
Block a user