openFeign如何开启zip压缩,优化网络通信传输?

提问者:帅平 问题分类:面试刷题
openFeign如何开启zip压缩,优化网络通信传输?
1 个回答
自沧桑
自沧桑
openFeign开启GZIP步骤也是很简单,只需要在配置文件中开启如下配置:
feign:
  ## 开启压缩
  compression:
    request:
      enabled: true
      ## 开启压缩的阈值,单位字节,默认2048,即是2k,这里为了演示效果设置成10字节
      min-request-size: 10
      mime-types: text/xml,application/xml,application/json
    response:
      enabled: true
发布于:1年前 (2023-05-07) IP属地:四川省
我来回答