2
我想使用spring webflux以反应式方式传输文件。
我的端点应该看起来像更具体什么是对象的类型?如何使用spring webflux进行文件流式传输
@GetMapping("/file")
Flux<???> file() {
//Read file content into this ??? thing .
}
我想使用spring webflux以反应式方式传输文件。
我的端点应该看起来像更具体什么是对象的类型?如何使用spring webflux进行文件流式传输
@GetMapping("/file")
Flux<???> file() {
//Read file content into this ??? thing .
}
你可以这样返回Resource
实例:
@GetMapping("/file")
Mono<Resource> file() {
//Create a ClassPathResource, for example
}
注意,这个自动支持字节范围的HTTP请求。