Lete乐特2020-12-26 12:45:59 170 1min正文打开配置文件application.yml COPY 123456server: port: 4000 # 端口(请忽略) compression: enabled: true # 开启Gzip mime-types: application/json,application/xml,text/html,text/xml,text/plain # 数据类型(还有很多数据类型,根据自己的情况修改) min-response-size: 100 # 开启压缩最小数据字节数默认2048个‘字节’其中min-response-size: 可能存在一些问题,经过测试,无论设置多少大小都会压缩,如下源码中的解释 COPY 123456789101112/*** Return the minimum "Content-Length" value that is required for compression to be* performed.* @return the minimum content size in bytes that is required for compression*/public DataSize getMinResponseSize() { return this.minResponseSize;}public void setMinResponseSize(DataSize minSize) { this.minResponseSize = minSize;}开启Gzip前开启Gzip后Tags:记录 Java SpringBoot GzipAuthorship: Lete乐特Article Link: https://blog.imlete.cn/article/SpringBoot-Gzip.htmlCopyright: All posts on this blog are licensed under the CC BY-NC-SA 4.0 license unless otherwise stated. Please cite Lete乐特 's Blog !