依赖引入
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-spring-cloud-gateway-adapter</artifactId>
<version>1.7.2</version>
</dependency>
在yml中配置路由
必须显式配置路由
spring:
application:
name: gateway
cloud:
nacos:
discovery:
server-addr: IP:8848
gateway:
discovery:
locator:
enabled: true
routes:
- id: provider_route
uri: http://localhost:8081
predicates:
- Path=/provider/**
filters:
- StripPrefix=1
编写配置类 配置过滤规则
import co