spring: application: name: gateway-service cloud: gateway: routes: - id: data-service1 #请求 http://localhost:8100/data-service1/test会转发到data-producer服务 uri: lb://data-producer #在服务注册中心找服务名为 data-producer的服务 predicates: - Path=/data-service1/* #设置路由断言,代理servicerId为data-service1的/ data-service1 /路径 filters: - StripPrefix=1 - id: data-service2 # 请求 http://localhost:8100/data-service2/test转发到 http://localhost:8080/test uri: http://localhost:8080 predicates: - Path=/data-service2/* filters: - StripPrefix=1 #前缀, 在当前路径匹配中表示去掉第一个前缀 /data-service2