gateway :路由配置我们希望基于配置中心管理路由信息。
apollo:配置中心 具体介绍请看apollo官网 https://github.com/ctripcorp/apollo
apollo动态更新route配置整体思路
apollo 相关的业务线我们不需要关系,只需要关心自己的应用接口
gateway集成只需加apollo-client的依赖即可
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>1.4.0</version>
</dependency>
编写gateway route更新类
package cn.jingrui.gateway.filter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.cloud.gateway.route.RouteDefinition;
imp