「 SPRINGCLOUD篇 」
十月 25, 2022
文章字数
16k
阅读约需
15 mins.
上篇中,我们获取到了请求数据报文,这篇继续获取响应报文并发往持久化存储
这里获取响应报文需要排除掉文件下载的情况
- 新建类 ModifyResponseBodyGatewayFilterFactoryCopy
该类照抄子 spring 源码 ModifyResponseBodyGatewayFilterFactory 添加了判断,当请求返回的头信息非 json 响应时, 将不再解析报文
/**
* 根据 spring 源码优化
* 优化了文件下载请求解析报文带来的内存使用
* 添加了如下代码判...
查看全文
「 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...
查看全文