spring:
cloud:
gateway:
routes:
- id: after_route
uri: http://127.0.0.1:8082
predicates:
- After=2021-08-16T07:36:00.000+08:00[Asia/Shanghai]
- 动态路由的JSON格式,注意args参数要用datetime:
[
{
“id”: “after_route”,
“uri”: “http://127.0.0.1:8082”,
“predicates”:[
{
“name”: “After”,
“args”: {
“datetime”: “2021-08-16T07:36:00.000+08:00[Asia/Shanghai]”
}
}
]
}
]
Before
-
Before表示路由在指定时间之前才生效
-
配置文件:
spring:
cloud:
gateway:
routes:
- id: before_route
uri: http://127.0.0.1:8082
predicates:
- Before=2021-08-16T07:36:00.000+08:00[Asia/Shanghai]
- 动态路由的JSON格式,注意args参数要用datetime:
[
{
“id”: “before_route”,
“uri”: “http://127.0.0.1:8082”,
“predicates”:[
{
“name”: “Before”,
“args”: {
“datetime”: “2021-08-16T07:36:00.000+08:00[Asia/Shanghai]”
}
}
]
}
]