spring webflux功能正常时,图像请求保持挂起状态

spring webflux功能正常时,图像请求保持挂起状态,spring,spring-data-mongodb,spring-webflux,project-reactor,Spring,Spring Data Mongodb,Spring Webflux,Project Reactor,我需要用gridfs返回存储在mogodb中的一个图像,但是每次我得到该图像时,请求都会被挂起。特别是,超过40k的图像会出现这种情况。 实际上我使用的是spring数据mongodb 2.2.0.M2 使用的代码如下所示 MediaRepository.kt fun getById(id: String): Mono<ReactiveGridFsResource> { return gridFsOperations.findFirst(Query(Criteria.wher

我需要用gridfs返回存储在mogodb中的一个图像,但是每次我得到该图像时,请求都会被挂起。特别是,超过40k的图像会出现这种情况。 实际上我使用的是spring数据mongodb 2.2.0.M2

使用的代码如下所示

MediaRepository.kt

fun getById(id: String): Mono<ReactiveGridFsResource> {
    return gridFsOperations.findFirst(Query(Criteria.where("_id").`is`(id)))
        .flatMap { file ->
            gridFsOperations.getResource(file)
        }
}
fun getById(id:String):Mono{
返回gridFsOperations.findFirst(查询(条件.where(“\u id”)。`is`(id)))
.flatMap{file->
gridFsOperations.getResource(文件)
}
}
MediaHandler.kt

fun getById(request: ServerRequest): Mono<ServerResponse> {
    val id: String = request.pathVariable("id")

    return mediaRepository.getById(id)
        .flatMap { resource ->
            ServerResponse.ok()
                .header(CONTENT_TYPE, "image/jpeg")
                .body(BodyInserters.fromDataBuffers(resource.downloadStream))
        }
        .switchIfEmpty(ServerResponse.notFound().build())
}
fun getById(请求:ServerRequest):Mono{
val id:String=request.pathVariable(“id”)
返回mediaRepository.getById(id)
.flatMap{resource->
ServerResponse.ok()
.标题(内容类型,“图像/jpeg”)
.body(BodyInserters.fromDataBuffers(resource.downloadStream))
}
.switchIfEmpty(ServerResponse.notFound().build())
}

提前感谢您

您遇到了什么异常情况?我没有收到任何异常情况,请求仍在等待中。您能否提供一个示例项目,以便我们能够调试和跟踪问题?非常感谢您的回答,我共享到github存储库的链接:@mp911de如果我按了,我很抱歉,但是有什么消息吗?非常感谢您您收到了什么异常?我没有收到任何异常,请求仍在等待中。您能否提供一个示例项目,以便我们能够调试和跟踪问题?非常感谢您的回答,我共享到github存储库的链接:@mp911de如果我按下,我很抱歉,但是有什么消息吗?非常感谢你