Skip to content

Commit

Permalink
添加路由
Browse files Browse the repository at this point in the history
  • Loading branch information
cdtft committed Jul 6, 2020
1 parent 6495d9a commit 280a905
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.github.cdtft.microservices.gateway.config;

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;

/**
* @author : wangcheng
* @date : 2020年07月06日 10:25
*/
@Configuration
public class GatewayConfig {

@Bean
public RouteLocator routeLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route(r -> r.path("/provider/**").uri("http://localhost:8070/provider"))
.build();
}
}
1 change: 0 additions & 1 deletion gateway/src/main/resources/application.properties

This file was deleted.

9 changes: 9 additions & 0 deletions gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server:
port: 8071
spring:
application:
name: gateway
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
2 changes: 2 additions & 0 deletions service-provider/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
server:
port: 8070
servlet:
context-path: /provider
spring:
application:
name: provider
Expand Down

0 comments on commit 280a905

Please sign in to comment.