「 SPRINGCLOUD篇 」
十月 15, 2022
文章字数
8.7k
阅读约需
8 mins.
SpringCloud Gateway 中想要获取请求体数据,这里介绍一种优雅的处理方法,就是使用 框架自带的 ModifyRequestBodyGatewayFilterFactory
新建类 RequestLogFilter
@Slf4j
@Component
@AllArgsConstructor
public class RequestLogFilter implements GlobalFilter, Ordered {
private final ModifyRequestBodyGatewayFi...
查看全文
「 SPRINGCLOUD篇 」
八月 22, 2022
文章字数
5k
阅读约需
5 mins.
记录下 OpenApi3 + SpringCloud Gateway 聚合文档的过程
- SpringDoc
- Knife4j
- SpringCloud Gateway
在所有的 spring boot 项目中引入 SpringDoc
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version...
查看全文
「 SPRINGCLOUD篇 」
十一月 05, 2021
文章字数
2.1k
阅读约需
2 mins.
使用 @ConfigurationProperties(prefix = "xxxx")
注解配置类
在 Nacos 配置中心里修改相应的配置会自动的刷新属性(配置类上不需要注解 @RefreshScope)
还可以通过发送 POST 请求手动刷新 /actuator/refresh 配置
修改保存后会发现日志打印出如下内容:
2021-09-29 01:02:22.081 INFO [etc-gateway,,] 2664 --- [xxx_6101] c.a.n.client...
查看全文
「 SPRINGCLOUD篇 」
四月 02, 2021
文章字数
458
阅读约需
1 mins.
配置
将原先的接口提取出来,单独写一份
@FeignClient(value = “etc-exchange”, contextId = “etc-exchange-2”, fallback = PsamRemoteServiceFallback2.class)
重新声明一个 contextId
添加配置项
feign:
client:
config:
etc-exchange-2:
connect-timeout: 3000
read-timeout: 3000
查看全文