三种路由网关的配置
1、直接path配置
spring: application: name: test-gateway-service cloud: gateway: routes: - id: after_route uri: http://localhost:8081/ predicates: - Path=/shop/**
2、动态配置-通过注册中心的服务名称,适合多个节点
spring: application: name: test-gateway-service cloud: gateway: discovery: locator: enabled: true lowerCaseServiceId: true routes: - id: after_route uri: lb://test-shop/ predicates: - Path=/shop/**
注意:需要把网关注册到服务中心上面
3、通过服务名称来实现跳转
spring: application: name: test-gateway-service cloud: gateway: discovery: locator: enabled: true lowerCaseServiceId: true
注意:需要把网关注册到服务中心上面
参考学习视频:https://www.bilibili.com/video/BV14h411f7Wa?p=13&spm_id_from=pageDriver