I'm using Spring web-flux with Reactor and for me is not clear when RestController method should return
Mono <List<Object>>
and when Flux<Object>
.
Could you provide some case when to use each of them?
I'm using Spring web-flux with Reactor and for me is not clear when RestController method should return
Mono <List<Object>>
and when 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.
See also Mono vs Flux in Reactive Stream
>` instead of `Flux
– Marco Apr 06 '21 at 07:03