1. 引入maven依赖
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</exclusion>
</exclusions>
</dependency>
2. appliaction配置
server:
port: 8888
spring:
application:
name: tensquare-gateway
cloud:
gateway:
#配置路由规则
routes:
# 路由id,可以随意写
- id: base-service
# 代理的服务uri