默认全局设置都要开始清空, 为了动态加载, 这样不会加载多次

This commit is contained in:
eson 2019-07-07 23:04:26 +08:00
parent 57355309b7
commit 6b61269e8e

View File

@ -63,10 +63,7 @@ public class ConfigGateway implements RouteDefinitionLocator {
@SuppressWarnings("unchecked")
public Flux<RouteDefinition> getRouteDefinitions() {
// WebFluxConfigurationSupport a;
defaultFilters.clear();
Object inputStream = null;
String[] gatewayConfigPathList = { "gateway.yml", "gateway.yaml", "Gateway.yml", "Gateway.yaml" };
for (String gatewayConfigPath : gatewayConfigPathList) {
@ -108,7 +105,6 @@ public class ConfigGateway implements RouteDefinitionLocator {
this.configHttp2Dubbo(routeList, dubboYaml);
}
if (!routeList.isEmpty()) {
return Flux.fromIterable(routeList);
}
@ -124,6 +120,7 @@ public class ConfigGateway implements RouteDefinitionLocator {
private void getDefaultFilter(List<FilterDefinition> filters, Map<String, Object> defaultYaml) {
// default-filters: 下的相关设置
Object unknownDefaultFilters = defaultYaml.get("default-filters");
if (unknownDefaultFilters != null) {
List<String> defaultFiltersYaml = (ArrayList<String>) unknownDefaultFilters;
for (String filterString : defaultFiltersYaml) {
@ -322,17 +319,21 @@ public class ConfigGateway implements RouteDefinitionLocator {
String yamlField) {
List<String> filtersYaml = iter.get(yamlField);
if (filtersYaml != null) {
filters.addAll(defaultFilters);
for (String filterString : filtersYaml) {
filters.add(new FilterDefinition(filterString));
}
}
}
private void ParseAndAddDubboFilters(String dubboUri, List<FilterDefinition> filters, LinkedHashMap<String, List<String>> iter,
String yamlField) {
private void ParseAndAddDubboFilters(String dubboUri, List<FilterDefinition> filters,
LinkedHashMap<String, List<String>> iter, String yamlField) {
List<String> filtersYaml = iter.get(yamlField);
filters.addAll(defaultFilters);
if (filtersYaml != null) {
for (String filterString : filtersYaml) {
FilterDefinition fd = new FilterDefinition(filterString);