spring boot开启gzip

Web服务使用Spring Boot2X且运行在Tomcat或者Jetty中,支持gzip压缩可以

修改配置文件 application.properties

server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain
server.compression.min-response-size=1024

说明:

  server.compression.enabled是否开启压缩,默认为false

  server.compression.mime-types指定要压缩的MIME type

  server.compression.min-response-size执行压缩的阈值,默认为2048bytes

猜你喜欢

转载自www.cnblogs.com/baby123/p/12054149.html