I'm using Spring web-flux with Reactor and for me is not clear when RestController method should return
Mono <List<Object>> and when
Mono <List<Object>>
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Mono <List<Object>> and when 问问题
Mono <List<Object>> and when Flux<Object>.
Flux<Object>
Could you provide some case when to use each of them?
Flux<Object> indicates that new Object instances can be pushed in a reactive way at any point. With Mono<List<Object>>, you will get 1 time a value that is a list of objects, but that list will never change.
Object
Mono<List<Object>>
See also Mono vs Flux in Reactive Stream
Flux<Object>表示Object可以在任何时候以反应方式推送新实例。使用Mono<List<Object>>,您将获得 1 次作为对象列表的值,但该列表永远不会改变。
另请参阅响应式流中的 Mono vs Flux