Spring Cloud Gateway - 刷新路由 [英] Spring Cloud Gateway - Refreshing routes

查看:45
本文介绍了Spring Cloud Gateway - 刷新路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 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:

  1. 在 Spring Cloud Config Server (2.0.0.M7) 中托管的 application.yml 文件中的路由配置
  2. 在 application.yml 中添加/删除/修改路由
  3. POST/actuator/refresh --> 这将重新加载路由定义
  4. POST/application/gateway/refresh --> 这将重新加载路由
  5. 尝试新路线

这篇关于Spring Cloud Gateway - 刷新路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆