gpt4 book ai didi

spring-boot - 如何使用 Spring Webflux 返回 GZIP 响应?

转载 作者:行者123 更新时间:2023-12-05 08:31:49 26 4
gpt4 key购买 nike

假设我有一个使用 Spring Webflux 的非常简单的 HTTP 端点:

@GetMapping
fun greeting(@RequestParam("msg") val message : String) = Mono.just(Greeting(message))

其中 Greeting 是一个序列化为 JSON 的简单 DTO。我如何指示 Spring Webflux 返回压缩为 GZIP 的响应?如果重要的话,我正在使用 Netty 实现。

最佳答案

你要找的是服务器压缩属性

server.compression.enabled=true
server.compression.min-response-size=1024

关于spring-boot - 如何使用 Spring Webflux 返回 GZIP 响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55237276/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com