File tree Expand file tree Collapse file tree 4 files changed +13
-11
lines changed
java/com/macro/cloud/config Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 8
8
/**
9
9
* Created by macro on 2019/9/24.
10
10
*/
11
- @ Configuration
11
+ // @Configuration
12
12
public class GatewayConfig {
13
13
14
14
@ Bean
Original file line number Diff line number Diff line change 10
10
*/
11
11
@ Configuration
12
12
public class RedisRateLimiterConfig {
13
- @ Bean
14
- KeyResolver userKeyResolver () {
15
- return exchange -> Mono .just (exchange .getRequest ().getQueryParams ().getFirst ("username" ));
16
- }
13
+ // @Bean
14
+ // KeyResolver userKeyResolver() {
15
+ // return exchange -> Mono.just(exchange.getRequest().getQueryParams().getFirst("username"));
16
+ // }
17
17
18
18
@ Bean
19
19
public KeyResolver ipKeyResolver () {
Original file line number Diff line number Diff line change 7
7
gateway :
8
8
discovery :
9
9
locator :
10
- enabled : true
11
- lower-case-service-id : true
10
+ enabled : true # 开启从注册中心动态创建路由的功能
11
+ lower-case-service-id : true # 使用小写服务名,默认是大写
12
12
eureka :
13
13
client :
14
14
service-url :
Original file line number Diff line number Diff line change 1
1
server :
2
2
port : 9201
3
3
spring :
4
+ redis :
5
+ host : localhost
6
+ port : 6379
4
7
cloud :
5
8
gateway :
6
9
routes :
7
- - id : retry_test
10
+ - id : retry_route
8
11
uri : http://localhost:8201
9
12
predicates :
10
13
- Method=GET
11
14
filters :
12
15
- name : Retry
13
16
args :
14
- retries : 1
15
- statuses : BAD_GATEWAY
17
+ retries : 1 # 需要进行重试的次数
18
+ statuses : BAD_GATEWAY # 返回哪个状态码需要进行重试,返回状态码为5XX进行重试
16
19
backoff :
17
20
firstBackoff : 10ms
18
21
maxBackoff : 50ms
19
22
factor : 2
20
23
basedOnPreviousValue : false
21
-
22
24
logging :
23
25
level :
24
26
org.springframework.cloud.gateway : debug
You can’t perform that action at this time.
0 commit comments