Closed ksewen closed 5 years ago
Looks great, thanks!
However, I have a question regarding the following refresh logic:
private void refreshGatewayProperties(ConfigChangeEvent changeEvent) {
logger.info("Refreshing GatewayProperties!");
preDestroyGatewayProperties();
this.applicationContext.publishEvent(new EnvironmentChangeEvent(changeEvent.changedKeys()));
refreshGatewayRouteDefinition();
logger.info("GatewayProperties refreshed!");
}
After preDestroyGatewayProperties
is executed and before refreshGatewayRouteDefinition
is executed, what will happen if user access http://localhost:9090
?
in that time, the route has not be updated, if u follow the guide in README.md, u will route to https://githu.com
.
Spring listened EnvironmentChangeEvent to rebind the properties of bean with @ConfigurationProperties
and Spring Cloud Gateway listened RefreshRoutesEvent to refresh routeDefinitions.
u can see implements of RouteDefinitionLocator, in this case ,Spring Cloud Gateway will refresh the routes define in PropertiesRouteDefinitionLocator.
1、dynamic route config by apollo; 2、example how to dynamic delete route definition;