diff --git a/spring-cloud-alibaba-dependencies/pom.xml b/spring-cloud-alibaba-dependencies/pom.xml
index d4e8ee0ef..e385d5617 100644
--- a/spring-cloud-alibaba-dependencies/pom.xml
+++ b/spring-cloud-alibaba-dependencies/pom.xml
@@ -18,7 +18,7 @@
Spring Cloud Alibaba Dependencies
- 2.2.1.RELEASE
+ 2.2.2-SNAPSHOT
1.7.2
3.1.0
1.3.0
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudClientBootstrap.java b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudClientBootstrap.java
index 5171d48f9..35e171a0e 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudClientBootstrap.java
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudClientBootstrap.java
@@ -17,7 +17,8 @@
package com.alibaba.cloud.dubbo.bootstrap;
import com.alibaba.cloud.dubbo.service.EchoService;
-import org.apache.dubbo.config.annotation.Reference;
+
+import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -33,7 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
public class DubboSpringCloudClientBootstrap {
- @Reference
+ @DubboReference
private EchoService echoService;
@GetMapping("/echo")
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/resources/bootstrap.yaml b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/resources/bootstrap.yaml
index 757a772f1..6801b6c4b 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/resources/bootstrap.yaml
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/resources/bootstrap.yaml
@@ -1,8 +1,9 @@
dubbo:
- registry:
- address: spring-cloud://localhost
cloud:
subscribed-services: spring-cloud-alibaba-dubbo-server
+ protocols:
+ dubbo:
+ port: -1
spring:
application:
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudConsumerBootstrap.java b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudConsumerBootstrap.java
index 000859ca3..550394c16 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudConsumerBootstrap.java
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudConsumerBootstrap.java
@@ -23,7 +23,8 @@ import com.alibaba.cloud.dubbo.annotation.DubboTransported;
import com.alibaba.cloud.dubbo.service.RestService;
import com.alibaba.cloud.dubbo.service.User;
import com.alibaba.cloud.dubbo.service.UserService;
-import org.apache.dubbo.config.annotation.Reference;
+
+import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -60,10 +61,10 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@EnableCaching
public class DubboSpringCloudConsumerBootstrap {
- @Reference
+ @DubboReference
private UserService userService;
- @Reference(version = "1.0.0", protocol = "dubbo")
+ @DubboReference(version = "1.0.0", protocol = "dubbo")
private RestService restService;
@Autowired
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/resources/application.yaml b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/resources/application.yaml
index c46f7a87e..17945be2c 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/resources/application.yaml
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/resources/application.yaml
@@ -1,15 +1,10 @@
dubbo:
- registry:
- # The Spring Cloud Dubbo's registry extension
- ## the default value of dubbo-provider-services is "*", that means to subscribe all providers,
- ## thus it's optimized if subscriber specifies the required providers.
- address: spring-cloud://localhost
-# The traditional Dubbo's registry also is supported
-# address: zookeeper://127.0.0.1:2181
cloud:
# The subscribed services in consumer side
subscribed-services: ${provider.application.name}
-
+ protocols:
+ dubbo:
+ port: -1
consumer:
check: false
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java
index bd11c4131..b1acd0a06 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java
@@ -20,12 +20,12 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.config.annotation.DubboService;
/**
* In-Memory {@link UserService} implementation.
*/
-@Service(protocol = "dubbo")
+@DubboService(protocol = "dubbo")
public class InMemoryUserService implements UserService {
private Map usersRepository = new HashMap<>();
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/StandardRestService.java b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/StandardRestService.java
index a71cc1936..d39df81d8 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/StandardRestService.java
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/java/com/alibaba/cloud/dubbo/service/StandardRestService.java
@@ -30,7 +30,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.config.annotation.DubboService;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +43,7 @@ import static org.springframework.util.MimeTypeUtils.APPLICATION_JSON_VALUE;
*
* @author Mercy
*/
-@Service(version = "1.0.0", protocol = { "dubbo", "rest" })
+@DubboService(version = "1.0.0", protocol = { "dubbo", "rest" })
@Path("/")
public class StandardRestService implements RestService {
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/resources/application.yaml b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/resources/application.yaml
index 1a7ec7c59..5a8558436 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/resources/application.yaml
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/resources/application.yaml
@@ -9,11 +9,6 @@ dubbo:
name: rest
port: 9090
server: netty
- registry:
-# The Spring Cloud Dubbo's registry extension
- address: spring-cloud://localhost
-# The traditional Dubbo's registry
-# address: zookeeper://127.0.0.1:2181
feign:
hystrix:
enabled: true
\ No newline at end of file
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java
index bd11c4131..b1acd0a06 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/InMemoryUserService.java
@@ -20,12 +20,12 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.config.annotation.DubboService;
/**
* In-Memory {@link UserService} implementation.
*/
-@Service(protocol = "dubbo")
+@DubboService(protocol = "dubbo")
public class InMemoryUserService implements UserService {
private Map usersRepository = new HashMap<>();
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/SpringRestService.java b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/SpringRestService.java
index 0c8675389..af9f2c544 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/SpringRestService.java
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/java/com/alibaba/cloud/dubbo/service/SpringRestService.java
@@ -19,7 +19,8 @@ package com.alibaba.cloud.dubbo.service;
import java.util.HashMap;
import java.util.Map;
-import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.config.annotation.DubboService;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +40,7 @@ import static com.alibaba.cloud.dubbo.util.LoggerUtils.log;
*
* @author Mercy
*/
-@Service(version = "1.0.0")
+@DubboService(version = "1.0.0")
@RestController
public class SpringRestService implements RestService {
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/resources/application.yaml b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/resources/application.yaml
index b6858c746..2bc346c83 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/resources/application.yaml
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/resources/application.yaml
@@ -3,16 +3,7 @@ dubbo:
base-packages: com.alibaba.cloud.dubbo.service
protocols:
dubbo:
- name: dubbo
port: -1
- registries:
- new:
- address: spring-cloud://localhost
-# registry:
-# The Spring Cloud Dubbo's registry extension
-# address: spring-cloud://localhost
-# The traditional Dubbo's registry
-# address: nacos://127.0.0.1:8848
feign:
hystrix:
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudServerBootstrap.java b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudServerBootstrap.java
index bd7e17849..50816edbf 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudServerBootstrap.java
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudServerBootstrap.java
@@ -17,7 +17,8 @@
package com.alibaba.cloud.dubbo.bootstrap;
import com.alibaba.cloud.dubbo.service.EchoService;
-import org.apache.dubbo.config.annotation.Service;
+
+import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -36,7 +37,7 @@ public class DubboSpringCloudServerBootstrap {
}
-@Service
+@DubboService
class EchoServiceImpl implements EchoService {
@Override
diff --git a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/resources/bootstrap.yaml b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/resources/bootstrap.yaml
index 394df7ecf..650b9861c 100644
--- a/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/resources/bootstrap.yaml
+++ b/spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/resources/bootstrap.yaml
@@ -4,8 +4,6 @@ dubbo:
protocol:
name: dubbo
port: -1
- registry:
- address: spring-cloud://localhost
spring:
application:
diff --git a/spring-cloud-alibaba-starters/pom.xml b/spring-cloud-alibaba-starters/pom.xml
index 1249b019e..c3f083989 100644
--- a/spring-cloud-alibaba-starters/pom.xml
+++ b/spring-cloud-alibaba-starters/pom.xml
@@ -22,6 +22,7 @@
spring-cloud-starter-stream-rocketmq
spring-cloud-starter-bus-rocketmq
spring-cloud-starter-dubbo
+ spring-cloud-starter-dubbo-gateway
spring-cloud-starter-alibaba-sidecar
spring-cloud-circuitbreaker-sentinel
spring-cloud-starter-alibaba-sentinel
diff --git a/spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-gateway/pom.xml b/spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-gateway/pom.xml
index 2461c672b..49283a18e 100644
--- a/spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-gateway/pom.xml
+++ b/spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-gateway/pom.xml
@@ -59,6 +59,7 @@
spring-cloud-starter-gateway
true
+
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/discovery/NacosServiceDiscovery.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/discovery/NacosServiceDiscovery.java
index 7818a2956..e021e34b3 100644
--- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/discovery/NacosServiceDiscovery.java
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/discovery/NacosServiceDiscovery.java
@@ -95,7 +95,7 @@ public class NacosServiceDiscovery {
if (instance.getMetadata() != null) {
metadata.putAll(instance.getMetadata());
}
- metadata.put("nacos.ephemeral",String.valueOf(instance.isEphemeral()));
+ metadata.put("nacos.ephemeral", String.valueOf(instance.isEphemeral()));
nacosServiceInstance.setMetadata(metadata);
if (metadata.containsKey("secure")) {
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java
index 94185c8a3..2aa507bdd 100644
--- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/hystrix/SeataHystrixConcurrencyStrategy.java
@@ -44,7 +44,9 @@ import org.springframework.web.context.request.RequestContextHolder;
*/
public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy {
- private final Logger logger = LoggerFactory.getLogger(SeataHystrixConcurrencyStrategy.class);
+ private final Logger logger = LoggerFactory
+ .getLogger(SeataHystrixConcurrencyStrategy.class);
+
private HystrixConcurrencyStrategy delegate;
public SeataHystrixConcurrencyStrategy() {
@@ -53,45 +55,54 @@ public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
if (this.delegate instanceof SeataHystrixConcurrencyStrategy) {
return;
}
- HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook();
- HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance().getEventNotifier();
- HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance().getMetricsPublisher();
- HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy();
- logCurrentStateOfHystrixPlugins(eventNotifier, metricsPublisher, propertiesStrategy);
+ HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins
+ .getInstance().getCommandExecutionHook();
+ HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance()
+ .getEventNotifier();
+ HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance()
+ .getMetricsPublisher();
+ HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance()
+ .getPropertiesStrategy();
+ logCurrentStateOfHystrixPlugins(eventNotifier, metricsPublisher,
+ propertiesStrategy);
HystrixPlugins.reset();
HystrixPlugins.getInstance().registerConcurrencyStrategy(this);
- HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook);
+ HystrixPlugins.getInstance()
+ .registerCommandExecutionHook(commandExecutionHook);
HystrixPlugins.getInstance().registerEventNotifier(eventNotifier);
HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher);
HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy);
- } catch (Exception ex) {
+ }
+ catch (Exception ex) {
logger.error("Failed to register Seata Hystrix Concurrency Strategy", ex);
}
}
private void logCurrentStateOfHystrixPlugins(HystrixEventNotifier eventNotifier,
- HystrixMetricsPublisher metricsPublisher,
- HystrixPropertiesStrategy propertiesStrategy) {
+ HystrixMetricsPublisher metricsPublisher,
+ HystrixPropertiesStrategy propertiesStrategy) {
if (logger.isDebugEnabled()) {
- logger.debug("Current Hystrix plugins configuration is [" + "concurrencyStrategy [" + this.delegate + "],"
- + "eventNotifier [" + eventNotifier + "]," + "metricPublisher [" + metricsPublisher + "],"
- + "propertiesStrategy [" + propertiesStrategy + "]," + "]");
+ logger.debug("Current Hystrix plugins configuration is ["
+ + "concurrencyStrategy [" + this.delegate + "]," + "eventNotifier ["
+ + eventNotifier + "]," + "metricPublisher [" + metricsPublisher + "],"
+ + "propertiesStrategy [" + propertiesStrategy + "]," + "]");
logger.debug("Registering Seata Hystrix Concurrency Strategy.");
}
}
@Override
- public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixProperty corePoolSize,
- HystrixProperty maximumPoolSize,
- HystrixProperty keepAliveTime, TimeUnit unit,
- BlockingQueue workQueue) {
- return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize, keepAliveTime, unit,
- workQueue);
+ public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
+ HystrixProperty corePoolSize,
+ HystrixProperty maximumPoolSize,
+ HystrixProperty keepAliveTime, TimeUnit unit,
+ BlockingQueue workQueue) {
+ return this.delegate.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
+ keepAliveTime, unit, workQueue);
}
@Override
public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
- HystrixThreadPoolProperties threadPoolProperties) {
+ HystrixThreadPoolProperties threadPoolProperties) {
return this.delegate.getThreadPool(threadPoolKey, threadPoolProperties);
}
@@ -101,7 +112,8 @@ public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
}
@Override
- public HystrixRequestVariable getRequestVariable(HystrixRequestVariableLifecycle rv) {
+ public HystrixRequestVariable getRequestVariable(
+ HystrixRequestVariableLifecycle rv) {
return this.delegate.getRequestVariable(rv);
}
@@ -114,14 +126,16 @@ public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
Callable wrappedCallable;
if (this.delegate != null) {
wrappedCallable = this.delegate.wrapCallable(c);
- } else {
+ }
+ else {
wrappedCallable = c;
}
if (wrappedCallable instanceof SeataContextCallable) {
return wrappedCallable;
}
- return new SeataContextCallable<>(wrappedCallable, RequestContextHolder.getRequestAttributes());
+ return new SeataContextCallable<>(wrappedCallable,
+ RequestContextHolder.getRequestAttributes());
}
private static class SeataContextCallable implements Callable {
@@ -144,7 +158,8 @@ public class SeataHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
RequestContextHolder.setRequestAttributes(requestAttributes);
RootContext.bind(xid);
return actual.call();
- } finally {
+ }
+ finally {
RootContext.unbind();
RequestContextHolder.resetRequestAttributes();
}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/pom.xml b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/pom.xml
new file mode 100644
index 000000000..224e93e43
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/pom.xml
@@ -0,0 +1,167 @@
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-alibaba-starters
+ ${revision}
+ ../pom.xml
+
+
+ 4.0.0
+
+ spring-cloud-starter-dubbo-gateway
+ Spring Cloud Starter Dubbo Gateway
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-actuator
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-actuator-autoconfigure
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+ org.springframework.boot
+ spring-boot
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ true
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-commons
+ true
+
+
+
+ org.springframework.cloud
+ spring-cloud-context
+ true
+
+
+
+
+
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-gateway
+ true
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-dubbo
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.11
+
+
+
+
+ org.springframework
+ spring-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-test
+ test
+
+
+
+
+
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-zookeeper-discovery
+ ${spring-cloud-zookeeper.version}
+ test
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+
+
+
+ org.apache.zookeeper
+ zookeeper
+ 3.4.14
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+
+
+ org.apache.curator
+ curator-framework
+ ${curator.version}
+ test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayConstants.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayConstants.java
new file mode 100644
index 000000000..372f0e6f2
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayConstants.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.gateway;
+
+import com.alibaba.cloud.dubbo.util.DubboCloudConstants;
+
+/**
+ * The constants of Dubbo Cloud Gateway
+ *
+ * @author Mercy
+ */
+public interface DubboCloudGatewayConstants {
+
+ /**
+ * The property prefix of Configuration
+ */
+ String CONFIG_PROPERTY_PREFIX = DubboCloudConstants.CONFIG_PROPERTY_PREFIX
+ + ".gateway";
+
+}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayExecutor.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayExecutor.java
new file mode 100644
index 000000000..d591e9862
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayExecutor.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.gateway;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.alibaba.cloud.dubbo.http.MutableHttpServerRequest;
+import com.alibaba.cloud.dubbo.metadata.DubboRestServiceMetadata;
+import com.alibaba.cloud.dubbo.metadata.RequestMetadata;
+import com.alibaba.cloud.dubbo.metadata.RestMethodMetadata;
+import com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository;
+import com.alibaba.cloud.dubbo.service.DubboGenericServiceExecutionContext;
+import com.alibaba.cloud.dubbo.service.DubboGenericServiceExecutionContextFactory;
+import com.alibaba.cloud.dubbo.service.DubboGenericServiceFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.dubbo.rpc.service.GenericException;
+import org.apache.dubbo.rpc.service.GenericService;
+
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.format.support.DefaultFormattingConversionService;
+import org.springframework.http.HttpRequest;
+
+import static com.alibaba.cloud.dubbo.http.util.HttpUtils.getParameters;
+import static org.apache.commons.lang3.StringUtils.substringAfter;
+import static org.apache.commons.lang3.StringUtils.substringBetween;
+import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
+
+/**
+ * The executor of Dubbo Cloud Gateway that handles the HTTP request and responses the
+ * result of execution of the generic invocation to the Dubbo service providers
+ *
+ * @author Mercy
+ *
+ */
+public class DubboCloudGatewayExecutor {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private final DubboServiceMetadataRepository repository;
+
+ private final DubboGenericServiceFactory serviceFactory;
+
+ private final DubboGenericServiceExecutionContextFactory contextFactory;
+
+ private final DubboCloudGatewayProperties dubboCloudGatewayProperties;
+
+ private final ConversionService conversionService;
+
+ private final Map dubboTranslatedAttributes = new HashMap<>();
+
+ public DubboCloudGatewayExecutor(DubboServiceMetadataRepository repository,
+ DubboGenericServiceFactory serviceFactory,
+ DubboGenericServiceExecutionContextFactory contextFactory,
+ DubboCloudGatewayProperties dubboCloudGatewayProperties,
+ ObjectProvider conversionServices) {
+ this.repository = repository;
+ this.serviceFactory = serviceFactory;
+ this.contextFactory = contextFactory;
+ this.dubboCloudGatewayProperties = dubboCloudGatewayProperties;
+ this.conversionService = conversionServices
+ .getIfAvailable(DefaultFormattingConversionService::new);
+ // TODO : Replace these hard-code configurations
+ this.dubboTranslatedAttributes.put("protocol", "dubbo");
+ this.dubboTranslatedAttributes.put("cluster", "failover");
+ }
+
+ public Object execute(HttpRequest request) {
+
+ String serviceName = resolveServiceName(request);
+
+ String restPath = substringAfter(request.getURI().getPath(), serviceName);
+
+ // 初始化 serviceName 的 REST 请求元数据
+ repository.initializeMetadata(serviceName);
+ // 将 HttpServletRequest 转化为 RequestMetadata
+ RequestMetadata clientMetadata = buildRequestMetadata(request, restPath);
+
+ DubboRestServiceMetadata dubboRestServiceMetadata = repository.get(serviceName,
+ clientMetadata);
+
+ Object result = null;
+
+ if (dubboRestServiceMetadata != null) {
+
+ RestMethodMetadata dubboRestMethodMetadata = dubboRestServiceMetadata
+ .getRestMethodMetadata();
+
+ GenericService genericService = serviceFactory
+ .create(dubboRestServiceMetadata, dubboTranslatedAttributes);
+
+ byte[] body = getRequestBody(request);
+
+ MutableHttpServerRequest httpServerRequest = new MutableHttpServerRequest(
+ request, body);
+
+ DubboGenericServiceExecutionContext context = contextFactory
+ .create(dubboRestMethodMetadata, httpServerRequest);
+
+ GenericException exception = null;
+
+ try {
+ result = genericService.$invoke(context.getMethodName(),
+ context.getParameterTypes(), context.getParameters());
+
+ String returnType = dubboRestMethodMetadata.getReturnType();
+
+ logger.info("The result is " + result);
+
+ }
+ catch (GenericException e) {
+ exception = e;
+ }
+ }
+
+ return result;
+
+ }
+
+ private String resolveServiceName(HttpRequest request) {
+ URI uri = request.getURI();
+ String requestURI = uri.getPath();
+ String servletPath = dubboCloudGatewayProperties.getContextPath();
+ String part = substringAfter(requestURI, servletPath);
+ String serviceName = substringBetween(part, PATH_SEPARATOR, PATH_SEPARATOR);
+ return serviceName;
+ }
+
+ /**
+ * TODO : Get the Request Body from HttpRequest
+ *
+ * @param request {@link HttpRequest}
+ * @return
+ */
+ private byte[] getRequestBody(HttpRequest request) {
+ return new byte[0];
+ }
+
+ private RequestMetadata buildRequestMetadata(HttpRequest request, String restPath) {
+ RequestMetadata requestMetadata = new RequestMetadata();
+ requestMetadata.setPath(restPath);
+ requestMetadata.setMethod(request.getMethod().toString());
+ requestMetadata.setParams(getParameters(request));
+ requestMetadata.setHeaders(request.getHeaders());
+ return requestMetadata;
+ }
+
+}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayProperties.java
new file mode 100644
index 000000000..0582018f2
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/DubboCloudGatewayProperties.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.gateway;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import static com.alibaba.cloud.dubbo.gateway.DubboCloudGatewayConstants.CONFIG_PROPERTY_PREFIX;
+
+/**
+ * The Configuration Properties for Dubbo Cloud Gateway
+ *
+ * @author Mercy
+ */
+@ConfigurationProperties(prefix = CONFIG_PROPERTY_PREFIX)
+public class DubboCloudGatewayProperties {
+
+ /**
+ * Enabled or not
+ */
+ private boolean enabled = true;
+
+ /**
+ * The context path for the gateway request mapping
+ */
+ private String contextPath = "";
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ public void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/autoconfigure/DubboCloudGatewayAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/autoconfigure/DubboCloudGatewayAutoConfiguration.java
new file mode 100644
index 000000000..b0cf834ed
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/autoconfigure/DubboCloudGatewayAutoConfiguration.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.gateway.autoconfigure;
+
+import com.alibaba.cloud.dubbo.autoconfigure.DubboMetadataAutoConfiguration;
+import com.alibaba.cloud.dubbo.autoconfigure.DubboServiceAutoConfiguration;
+import com.alibaba.cloud.dubbo.gateway.DubboCloudGatewayExecutor;
+import com.alibaba.cloud.dubbo.gateway.DubboCloudGatewayProperties;
+import com.alibaba.cloud.dubbo.metadata.repository.DubboServiceMetadataRepository;
+import com.alibaba.cloud.dubbo.service.DubboGenericServiceExecutionContextFactory;
+import com.alibaba.cloud.dubbo.service.DubboGenericServiceFactory;
+
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.convert.ConversionService;
+
+@Configuration(proxyBeanMethods = false)
+@ConditionalOnProperty(prefix = "dubbo.cloud.gateway", name = "enabled", havingValue = "true", matchIfMissing = true)
+@AutoConfigureAfter({ DubboServiceAutoConfiguration.class,
+ DubboMetadataAutoConfiguration.class })
+@EnableConfigurationProperties(DubboCloudGatewayProperties.class)
+public class DubboCloudGatewayAutoConfiguration {
+
+ @Bean
+ @ConditionalOnMissingBean(DubboCloudGatewayExecutor.class)
+ public DubboCloudGatewayExecutor dubboCloudGatewayExecutor(
+ DubboServiceMetadataRepository repository,
+ DubboGenericServiceFactory serviceFactory,
+ DubboGenericServiceExecutionContextFactory contextFactory,
+ DubboCloudGatewayProperties dubboCloudGatewayProperties,
+ ObjectProvider conversionServices) {
+ return new DubboCloudGatewayExecutor(repository, serviceFactory, contextFactory,
+ dubboCloudGatewayProperties, conversionServices);
+ }
+}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayAutoConfiguration.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayAutoConfiguration.java
new file mode 100644
index 000000000..ef8929290
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayAutoConfiguration.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.gateway.standard;
+
+import com.alibaba.cloud.dubbo.autoconfigure.DubboMetadataAutoConfiguration;
+import com.alibaba.cloud.dubbo.autoconfigure.DubboServiceAutoConfiguration;
+import com.alibaba.cloud.dubbo.gateway.DubboCloudGatewayExecutor;
+import com.alibaba.cloud.dubbo.gateway.DubboCloudGatewayProperties;
+import com.alibaba.cloud.dubbo.gateway.autoconfigure.DubboCloudGatewayAutoConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.cloud.gateway.filter.GlobalFilter;
+import org.springframework.cloud.gateway.route.RouteLocator;
+import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.codec.ServerCodecConfigurer;
+import org.springframework.http.codec.support.DefaultServerCodecConfigurer;
+
+/**
+ * The Auto-{@link Configuration} of Dubbo Spring Cloud Gateway
+ *
+ * @author Mercy
+ */
+@Configuration(proxyBeanMethods = false)
+@ConditionalOnClass(GlobalFilter.class)
+@ConditionalOnProperty(prefix = "dubbo.cloud.gateway", name = "enabled", havingValue = "true", matchIfMissing = true)
+@AutoConfigureAfter({ DubboServiceAutoConfiguration.class,
+ DubboMetadataAutoConfiguration.class, DubboCloudGatewayAutoConfiguration.class })
+@EnableConfigurationProperties(DubboCloudGatewayProperties.class)
+public class DubboSpringCloudGatewayAutoConfiguration {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ @Bean
+ @ConditionalOnMissingBean(ServerCodecConfigurer.class)
+ public ServerCodecConfigurer serverCodecConfigurer() {
+ return new DefaultServerCodecConfigurer();
+ }
+
+ @Bean
+ public DubboSpringCloudGatewayFilter dubboSpringCloudGatewayFilter(
+ DubboCloudGatewayExecutor dubboCloudGatewayExecutor) {
+ return new DubboSpringCloudGatewayFilter(dubboCloudGatewayExecutor);
+ }
+
+ @Bean
+ public RouteLocator gatewayRoutes(RouteLocatorBuilder builder) {
+ return builder.routes()
+ .route(r -> r.path("/**").uri("http://localhost:9090").id("first"))
+ .build();
+ }
+
+}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayFilter.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayFilter.java
new file mode 100644
index 000000000..f9911fd91
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayFilter.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.gateway.standard;
+
+import com.alibaba.cloud.dubbo.gateway.DubboCloudGatewayExecutor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import reactor.core.publisher.Mono;
+
+import org.springframework.cloud.gateway.filter.GatewayFilter;
+import org.springframework.cloud.gateway.filter.GatewayFilterChain;
+import org.springframework.cloud.gateway.filter.GlobalFilter;
+import org.springframework.core.Ordered;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+import org.springframework.web.server.ServerWebExchange;
+
+/**
+ * The Spring Cloud {@link GatewayFilter Gateway Filter} for Dubbo
+ *
+ * @author Mercy
+ */
+public class DubboSpringCloudGatewayFilter
+ implements GatewayFilter, GlobalFilter, Ordered {
+
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private int order;
+
+ private final DubboCloudGatewayExecutor dubboCloudGatewayExecutor;
+
+ public DubboSpringCloudGatewayFilter(
+ DubboCloudGatewayExecutor dubboCloudGatewayExecutor) {
+ this.dubboCloudGatewayExecutor = dubboCloudGatewayExecutor;
+ }
+
+ @Override
+ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) {
+
+ Object result = dubboCloudGatewayExecutor.execute(exchange.getRequest());
+
+ if (result == null) {
+ chain.filter(exchange);
+ }
+ else {
+ ServerHttpResponse response = exchange.getResponse();
+ }
+
+ return Mono.empty();
+ }
+
+ public void setOrder(int order) {
+ this.order = order;
+ }
+
+ @Override
+ public int getOrder() {
+ return order;
+ }
+
+}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/resources/META-INF/spring.factories b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/resources/META-INF/spring.factories
new file mode 100644
index 000000000..463847c1a
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,3 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+com.alibaba.cloud.dubbo.gateway.autoconfigure.DubboCloudGatewayAutoConfiguration,\
+com.alibaba.cloud.dubbo.gateway.standard.DubboSpringCloudGatewayAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/test/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayBootstrap.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/test/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayBootstrap.java
new file mode 100644
index 000000000..662a131dc
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/test/java/com/alibaba/cloud/dubbo/gateway/standard/DubboSpringCloudGatewayBootstrap.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.gateway.standard;
+
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+/**
+ * The bootstrap class of Dubbo Spring Cloud Gateway
+ *
+ * @author Mercy
+ */
+@SpringBootApplication
+@EnableDiscoveryClient
+public class DubboSpringCloudGatewayBootstrap {
+
+ public static void main(String[] args) {
+ new SpringApplicationBuilder(DubboSpringCloudGatewayBootstrap.class)
+ .properties("spring.profiles.active=zookeeper").run(args);
+ }
+
+}
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/test/resources/application.yaml b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/test/resources/application.yaml
new file mode 100644
index 000000000..2f9abf4e4
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo-gateway/src/test/resources/application.yaml
@@ -0,0 +1,74 @@
+spring:
+ application:
+ name: spring-cloud-alibaba-dubbo-gateway
+ main:
+ allow-bean-definition-overriding: true
+
+dubbo:
+ protocols:
+ dubbo:
+ port: -1
+
+server:
+ port: 9090
+
+ # default disable all
+ cloud:
+ nacos:
+ discovery:
+ enabled: false
+ register-enabled: false
+ zookeeper:
+ enabled: false
+ consul:
+ enabled: false
+
+eureka:
+ client:
+ enabled: false
+
+
+---
+spring:
+ profiles: nacos
+
+ cloud:
+ nacos:
+ username: nacos
+ password: nacos
+ discovery:
+ enabled: true
+ register-enabled: true
+ server-addr: 127.0.0.1:8848
+ ephemeral: false
+
+
+---
+spring:
+ profiles: eureka
+
+eureka:
+ client:
+ enabled: true
+ service-url:
+ defaultZone: http://127.0.0.1:8761/eureka/
+
+
+---
+spring:
+ profiles: zookeeper
+ cloud:
+ zookeeper:
+ enabled: true
+ connect-string: 127.0.0.1:2181
+
+
+---
+spring:
+ profiles: consul
+
+ cloud:
+ consul:
+ enabled: true
+ host: 127.0.0.1
+ port: 8500
\ No newline at end of file
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo/src/main/java/com/alibaba/cloud/dubbo/env/DubboCloudProperties.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo/src/main/java/com/alibaba/cloud/dubbo/env/DubboCloudProperties.java
index 80a0a072d..3c19723f3 100644
--- a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo/src/main/java/com/alibaba/cloud/dubbo/env/DubboCloudProperties.java
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo/src/main/java/com/alibaba/cloud/dubbo/env/DubboCloudProperties.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.springframework.boot.context.properties.ConfigurationProperties;
+import static com.alibaba.cloud.dubbo.util.DubboCloudConstants.CONFIG_PROPERTY_PREFIX;
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
import static org.springframework.util.StringUtils.hasText;
import static org.springframework.util.StringUtils.trimAllWhitespace;
@@ -31,7 +32,7 @@ import static org.springframework.util.StringUtils.trimAllWhitespace;
*
* @author Mercy
*/
-@ConfigurationProperties(prefix = "dubbo.cloud")
+@ConfigurationProperties(prefix = CONFIG_PROPERTY_PREFIX)
public class DubboCloudProperties {
/**
diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo/src/main/java/com/alibaba/cloud/dubbo/util/DubboCloudConstants.java b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo/src/main/java/com/alibaba/cloud/dubbo/util/DubboCloudConstants.java
new file mode 100644
index 000000000..d491b0a14
--- /dev/null
+++ b/spring-cloud-alibaba-starters/spring-cloud-starter-dubbo/src/main/java/com/alibaba/cloud/dubbo/util/DubboCloudConstants.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alibaba.cloud.dubbo.util;
+
+/**
+ * The constants for Dubbo Spring Cloud
+ *
+ * @author Mercy
+ */
+public interface DubboCloudConstants {
+
+ /**
+ * The property prefix of Configuration
+ */
+ String CONFIG_PROPERTY_PREFIX = "dubbo.cloud";
+
+}