Commit c0145d28 by Nepxion

增加路由策略过滤器的执行顺序配置项

parent 4c366510
...@@ -11,4 +11,5 @@ package com.nepxion.discovery.plugin.strategy.gateway.constant; ...@@ -11,4 +11,5 @@ package com.nepxion.discovery.plugin.strategy.gateway.constant;
public class GatewayStrategyConstant { public class GatewayStrategyConstant {
public static final String SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER = "spring.application.strategy.gateway.filter.order"; public static final String SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER = "spring.application.strategy.gateway.filter.order";
public static final int SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER_VALUE = 8888;
} }
\ No newline at end of file
...@@ -40,6 +40,6 @@ public class GatewayStrategyFilter implements GlobalFilter, Ordered { ...@@ -40,6 +40,6 @@ public class GatewayStrategyFilter implements GlobalFilter, Ordered {
@Override @Override
public int getOrder() { public int getOrder() {
return environment.getProperty(GatewayStrategyConstant.SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER, Integer.class, 9999); return environment.getProperty(GatewayStrategyConstant.SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER, Integer.class, GatewayStrategyConstant.SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER_VALUE);
} }
} }
\ No newline at end of file
...@@ -18,6 +18,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest; ...@@ -18,6 +18,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import com.nepxion.discovery.common.constant.DiscoveryConstant; import com.nepxion.discovery.common.constant.DiscoveryConstant;
import com.nepxion.discovery.plugin.strategy.gateway.constant.GatewayStrategyConstant;
public class MyGatewayFilter implements GlobalFilter, Ordered { public class MyGatewayFilter implements GlobalFilter, Ordered {
@Override @Override
...@@ -30,7 +31,7 @@ public class MyGatewayFilter implements GlobalFilter, Ordered { ...@@ -30,7 +31,7 @@ public class MyGatewayFilter implements GlobalFilter, Ordered {
@Override @Override
public int getOrder() { public int getOrder() {
// Order必须小于9999 // Order必须小于8888
return 9998; return GatewayStrategyConstant.SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER_VALUE - 1;
} }
} }
\ No newline at end of file
...@@ -73,5 +73,5 @@ spring.boot.admin.client.url=http://localhost:5555 ...@@ -73,5 +73,5 @@ spring.boot.admin.client.url=http://localhost:5555
# spring.application.strategy.control.enabled=true # spring.application.strategy.control.enabled=true
# 开启和关闭Ribbon默认的ZoneAvoidanceRule负载均衡策略。一旦关闭,则使用RoundRobin简单轮询负载均衡策略。缺失则默认为true # 开启和关闭Ribbon默认的ZoneAvoidanceRule负载均衡策略。一旦关闭,则使用RoundRobin简单轮询负载均衡策略。缺失则默认为true
# spring.application.strategy.zone.avoidance.rule.enabled=true # spring.application.strategy.zone.avoidance.rule.enabled=true
# 路由策略过滤器的执行顺序(Order)。缺失则默认为9999 # 路由策略过滤器的执行顺序(Order)。缺失则默认为8888
# spring.application.strategy.gateway.filter.order=9999 # spring.application.strategy.gateway.filter.order=8888
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment