spring-boot启用gzip压缩测试

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/superman_xxx/article/details/81291392

spring-boot启用gzip压缩提升数据接口的访问速度

一、添加配置
传输数据大于1KB时启用压缩

server:
  port: 7474
  servlet:
    context-path: /web
  compression:
    enabled: true
    min-response-size: 1024
    mime-types:
    - image/png
    - image/jpeg
    - image/jpg
    - text/html
    - application/javascript
    - text/css
    - application/octet-stream
    - application/json

spring:
  thymeleaf:
    cache: false
  mvc:
    static-path-pattern: /path/**
  resources:
    static-locations: classpath:/static/

二、接口测试
1、启用压缩之前
这里写图片描述
2、启用压缩之后
这里写图片描述
经过测试,启用gzip数据流压缩之后可以很有效的提升数据接口的访问效率!

猜你喜欢

转载自blog.csdn.net/superman_xxx/article/details/81291392