首页 > 解决方案 > Mono 到 Flux 的 Spring 响应式列表

问题描述

我有一个

list.stream()
.map(element -> func());

其中 func() 返回 Mono。Mono<CustomObject>将此对象列表转换为Flux<CustomObject>并从流中返回的最简单方法是什么?

标签: javaspringreactive-programming

解决方案


List<Mono<CustomObject >> monoList = new ArrayList<>();
monoList(object);

Flux<CustomObject> flux = Flux.concat(monoList);

推荐阅读