Spring Cloud 检索网关中定义的路由
2024-01-05 16:36 更新
要检索网关中定义的路由,请向/actuator/gateway/routes
发出GET
请求。产生的响应类似于以下内容:
[{ "route_id": "first_route", "route_object": { "predicate": "org.springframework.cloud.gateway.handler.predicate.PathRoutePredicateFactory$$Lambda$432/1736826640@1e9d7e7d", "filters": [ "OrderedGatewayFilter{delegate=org.springframework.cloud.gateway.filter.factory.PreserveHostHeaderGatewayFilterFactory$$Lambda$436/674480275@6631ef72, order=0}" ] }, "order": 0 }, { "route_id": "second_route", "route_object": { "predicate": "org.springframework.cloud.gateway.handler.predicate.PathRoutePredicateFactory$$Lambda$432/1736826640@cd8d298", "filters": [] }, "order": 0 }]
该响应包含网关中定义的所有路由的详细信息。下表描述了响应的每个元素(即路线)的结构。
路径 | 类型 | 描述 |
---|---|---|
|
String |
The route id. |
|
Object |
The route predicate. |
|
Array |
The GatewayFilter factories applied to the route. |
|
Number |
The route order. |
以上内容是否对您有帮助:
更多建议: