如何从Mono平面图中获取通量?

问题描述 投票:0回答:1

我有以下代码:

public Flux<Foo> getFoos(String xyz) {
    return getBar(xyz).flatMap(b -> Flux.empty()));
}

但是会导致编译错误,因为getBars()返回了Mono<Bar>而不是Flux<Bar>。如何从Mono值的flatMap()返回磁通量?谢谢。

spring reactor
1个回答
0
投票

找到了解决方案。我只需要使用flatMapMany()而不是flatMap()

© www.soinside.com 2019 - 2024. All rights reserved.