Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈文顺
discovery
Commits
c0145d28
Commit
c0145d28
authored
May 20, 2019
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加路由策略过滤器的执行顺序配置项
parent
4c366510
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
6 deletions
+11
-6
discovery-plugin-strategy-starter-gateway/src/main/java/com/nepxion/discovery/plugin/strategy/gateway/constant/GatewayStrategyConstant.java
+2
-0
discovery-plugin-strategy-starter-gateway/src/main/java/com/nepxion/discovery/plugin/strategy/gateway/filter/GatewayStrategyFilter.java
+2
-1
discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MyGatewayFilter.java
+4
-2
discovery-springcloud-example-gateway/src/main/resources/bootstrap.properties
+3
-3
No files found.
discovery-plugin-strategy-starter-gateway/src/main/java/com/nepxion/discovery/plugin/strategy/gateway/constant/GatewayStrategyConstant.java
View file @
c0145d28
...
...
@@ -11,4 +11,5 @@ package com.nepxion.discovery.plugin.strategy.gateway.constant;
public
class
GatewayStrategyConstant
{
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
discovery-plugin-strategy-starter-gateway/src/main/java/com/nepxion/discovery/plugin/strategy/gateway/filter/GatewayStrategyFilter.java
View file @
c0145d28
...
...
@@ -40,6 +40,6 @@ public class GatewayStrategyFilter implements GlobalFilter, Ordered {
@Override
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
discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MyGatewayFilter.java
View file @
c0145d28
...
...
@@ -18,6 +18,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import
org.springframework.web.server.ServerWebExchange
;
import
com.nepxion.discovery.common.constant.DiscoveryConstant
;
import
com.nepxion.discovery.plugin.strategy.gateway.constant.GatewayStrategyConstant
;
public
class
MyGatewayFilter
implements
GlobalFilter
,
Ordered
{
@Override
...
...
@@ -30,7 +31,7 @@ public class MyGatewayFilter implements GlobalFilter, Ordered {
@Override
public
int
getOrder
()
{
// Order必须小于
9999
return
9998
;
// Order必须小于
8888
return
GatewayStrategyConstant
.
SPRING_APPLICATION_STRATEGY_GATEWAY_FILTER_ORDER_VALUE
-
1
;
}
}
\ No newline at end of file
discovery-springcloud-example-gateway/src/main/resources/bootstrap.properties
View file @
c0145d28
...
...
@@ -73,5 +73,5 @@ spring.boot.admin.client.url=http://localhost:5555
# spring.application.strategy.control.enabled=true
# 开启和关闭Ribbon默认的ZoneAvoidanceRule负载均衡策略。一旦关闭,则使用RoundRobin简单轮询负载均衡策略。缺失则默认为true
# spring.application.strategy.zone.avoidance.rule.enabled=true
# 路由策略过滤器的执行顺序(Order)。缺失则默认为9999
#
spring.application.strategy.gateway.filter.order
=
9999
\ No newline at end of file
# 路由策略过滤器的执行顺序(Order)。缺失则默认为8888
#
spring.application.strategy.gateway.filter.order
=
8888
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment