spring:
cloud:
gateway:
#设置路由:路由id、路由到微服务的uri、断言
routes:
- id: order_route #路由ID,全局唯一
uri: http://localhost:8020 #目标微服务的请求地址和端口
#配置过滤器工厂
filters:
- PrefixPath=/mall-order # 添加前缀 对应微服务需要配置context-path
mall-order中需要配置
server:
servlet:
context-path: /mall-order
测试:http://localhost:8888/order/findOrderByUserId/1 ====》http://localhost:8020/mall-order/order/findOrderByUserId/1