【问题标题】:How to specify compression level in spring boot 2.0?如何在 Spring Boot 2.0 中指定压缩级别?
【发布时间】:2018-12-18 09:13:04
【问题描述】:

如何在 spring boot 2.0 应用程序中指定压缩级别?

文档中指定的选项仅允许您启用/禁用压缩、指定 mime 类型和指定最小响应大小。

它会在最大级别(即所有响应的级别 9)进行压缩吗?

【问题讨论】:

    标签: spring-boot


    【解决方案1】:

    尝试: spring.http.gzip.deflate-compression-level= # 用于 deflate 压缩的级别 (0-9)。附录:

     # HTTP response compression (GzipFilterProperties)
        spring.http.gzip.buffer-size= # size of the output buffer in bytes
        spring.http.gzip.deflate-compression-level= # the level used for deflate compression (0-9)
        spring.http.gzip.deflate-no-wrap= # noWrap setting for deflate compression (true or false)
        spring.http.gzip.enabled=true # enable gzip filter support
        spring.http.gzip.excluded-agents= # comma-separated list of user agents to exclude from compression
        spring.http.gzip.exclude-agent-patterns= # comma-separated list of regular expression patterns to control user agents excluded from compression
        spring.http.gzip.exclude-paths= # comma-separated list of paths to exclude from compression
        spring.http.gzip.exclude-path-patterns= # comma-separated list of regular expression patterns to control the paths that are excluded from compression
        spring.http.gzip.methods= # comma-separated list of HTTP methods for which compression is enabled
        spring.http.gzip.mime-types= # comma-separated list of MIME types which should be compressed
        spring.http.gzip.excluded-mime-types= # comma-separated list of MIME types to exclude from compression
        spring.http.gzip.min-gzip-size= # minimum content length required for compression to occur
        spring.http.gzip.vary= # Vary header to be sent on responses that may be compressed
    

    【讨论】:

    • 用正确的 Spring Boot 版本更新了我的问题。这些配置不适用于 spring boot 2.0
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-15
    • 2022-11-04
    • 2021-06-03
    • 1970-01-01
    • 2017-08-11
    • 1970-01-01
    相关资源
    最近更新 更多