Spring Cloud Gateway - 刷新路由 [英] Spring Cloud Gateway - Refreshing routes
问题描述
使用 spring-cloud-gateway 2.0.0.M5,我在配置文件(application.yml)中定义路由.我正在尝试通过调用 POST/application/gateway/refresh 来更新这些路由.
Using spring-cloud-gateway 2.0.0.M5, Im defining routes in configuration file (application.yml). I'm trying to update these routes by calling POST /application/gateway/refresh.
修改后的路由或新路由不会刷新,即使我看到(带有断点)实际执行了刷新例程.
Modified routes, or new routes, are not refreshed, even though I see (with a breakpoint) that a refresh routine is actually executed.
在配置文件中定义路由时刷新是否应该工作?我错过了什么?
Is the refresh supposed to work when routes are defined in configuration files ? Something I am missing ?
用例是在 spring 配置服务器中定义的路由.
The use case would be routes defined in spring config server.
推荐答案
对于那些在同一问题上苦苦挣扎的人,这里有一个适用于 2.0.0.M5 的设置:
For those struggling with the same issue, here is a setup which works with 2.0.0.M5:
- 在 Spring Cloud Config Server (2.0.0.M7) 中托管的 application.yml 文件中的路由配置
- 在 application.yml 中添加/删除/修改路由
- POST/actuator/refresh --> 这将重新加载路由定义
- POST/application/gateway/refresh --> 这将重新加载路由
- 尝试新路线
这篇关于Spring Cloud Gateway - 刷新路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!