12
votes

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?

1

1 Answers

12
votes

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