【SpringCloud】5、Spring Cloud Gateway网关路由规则

Spring Cloud Gateway 创建 Route 对象时, 使用 RoutePredicateFactory 创建 Predicate 对象,Predicate 对象可以赋值给 Route。

  • Spring Cloud Gateway包含许多内置的Route Predicate Factories。
  • 所有这些断言都匹配 HTTP 请求的不同属性。
  • 多个 Route Predicate Factories 可以通过逻辑与(and)结合起来一起使用。

路由断言工厂 RoutePredicateFactory 包含的主要实现类如图所示,包括 Datetime、请求的远端地址、路由权重、请求头、Host 地址、请求方法、请求路径和请求参数等类型的路由断言。

1、Datetime

匹配指定日期时间之前、之后、区间发生的请求

spring: 
  application:
    name: bt-gateway
  cloud:
    gateway

你可能感兴趣的:(SpringCloud系列,springcloud,springboot,gateway,微服务,Route)