在网关项目中增加如下配置:
@Configuration
public class ZuulConfig {
@Bean(name="zuul.CONFIGURATION_PROPERTIES")
@RefreshScope
@ConfigurationProperties("zuul")
@Primary
public ZuulProperties zuulProperties() {
return new ZuulProperties();
}
}
将zuul网关路由配置放入nacos中:
QQ截图20191220152114.png然后通过nacos进行发布,即可实现动态刷新网关路由
网友评论