Joh*_*han 0 spring-boot spring-webflux
假设我有一个使用 Spring Webflux 的非常简单的 HTTP 端点:
@GetMapping
fun greeting(@RequestParam("msg") val message : String) = Mono.just(Greeting(message))
Run Code Online (Sandbox Code Playgroud)
哪里Greeting是一个简单的 DTO 序列化为 JSON。如何指示 Spring Webflux 返回压缩为 GZIP 的响应?如果重要的话,我正在使用 Netty 实现。
您正在寻找的是服务器压缩属性
server.compression.enabled=true
server.compression.min-response-size=1024
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1529 次 |
| 最近记录: |