1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

Polish alibaba/spring-cloud-alibaba#1661 : [Feature] Introducing Dubbo Gateway

This commit is contained in:
mercyblitz 2020-09-02 10:59:14 +08:00
parent c419c1ef5d
commit c3173465ea
7 changed files with 92 additions and 93 deletions

View File

@ -106,12 +106,12 @@
<scope>test</scope>
</dependency>
<!-- &lt;!&ndash; Eureka Service Discovery &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- Eureka Service Discovery -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<scope>test</scope>
</dependency>
<!-- Zookeeper Service Discovery -->
<dependency>
@ -147,20 +147,20 @@
<scope>test</scope>
</dependency>
<!-- &lt;!&ndash; Spring Cloud Consul &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-consul-discovery</artifactId>-->
<!-- <version>${spring-cloud-consul.version}</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- Spring Cloud Consul -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
<version>${spring-cloud-consul.version}</version>
<scope>test</scope>
</dependency>
<!-- &lt;!&ndash; Nacos Service Discovery &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.alibaba.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- Nacos Service Discovery -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -71,12 +71,12 @@ public class DubboCloudGatewayExecutor {
DubboGenericServiceFactory serviceFactory,
DubboGenericServiceExecutionContextFactory contextFactory,
DubboCloudGatewayProperties dubboCloudGatewayProperties,
ObjectProvider<ConversionService> conversionServices) {
ObjectProvider<ConversionService> conversionService) {
this.repository = repository;
this.serviceFactory = serviceFactory;
this.contextFactory = contextFactory;
this.dubboCloudGatewayProperties = dubboCloudGatewayProperties;
this.conversionService = conversionServices
this.conversionService = conversionService
.getIfAvailable(DefaultFormattingConversionService::new);
// TODO : Replace these hard-code configurations
this.dubboTranslatedAttributes.put("protocol", "dubbo");

View File

@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.cloud.dubbo.gateway.standard;
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.gateway.autoconfigure.DubboCloudGatewayAutoConfiguration;
import com.alibaba.cloud.dubbo.gateway.standard.DubboSpringCloudGatewayFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@ -1,3 +1,3 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.alibaba.cloud.dubbo.gateway.autoconfigure.DubboCloudGatewayAutoConfiguration,\
com.alibaba.cloud.dubbo.gateway.standard.DubboSpringCloudGatewayAutoConfiguration
com.alibaba.cloud.dubbo.gateway.autoconfigure.DubboSpringCloudGatewayAutoConfiguration

View File

@ -31,7 +31,7 @@ public class DubboSpringCloudGatewayBootstrap {
public static void main(String[] args) {
new SpringApplicationBuilder(DubboSpringCloudGatewayBootstrap.class)
.properties("spring.profiles.active=zookeeper").run(args);
.properties("spring.profiles.active=nacos").run(args);
}
}

View File

@ -1,74 +1,7 @@
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
port: 9090

View File

@ -0,0 +1,66 @@
spring:
application:
name: spring-cloud-alibaba-dubbo-gateway
main:
allow-bean-definition-overriding: true
# default disable all
cloud:
nacos:
username: nacos
password: nacos
discovery:
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:
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