Spring Cloud 查询路由谓词工厂
Query Route Predicate Factory采用两个参数:必需的param和可选的regexp(这是Java正则表达式)。
application.yml。
spring: cloud: gateway: routes: - id: query_route uri: https://example.org predicates: - Query=baz
如果请求包含baz查询参数,则此路由将匹配。
application.yml。
spring: cloud: gateway: routes: - id: query_route uri: https://example.org predicates: - Query=foo, ba.
如果请求包含一个foo查询参数,其值与ba.正则表达式匹配,则此路由将匹配,因此bar和baz将匹配。