I have a method looks like this.
@GetMapping
Some read() {
return getSome();
}
Now I want to change the result's type as a Mono as leave the getSome() non-reactive.
The question is which one is better? Or are they equivalent in the context of reactive system?
@GetMapping
Mono<Some> read() {
return Mono.justOrEmpty(getSome()); // getSome() is still non-reactive
}
@GetMapping
Mono<Some> read() {
return Mono.fromSupplier(() -> getSome()); // getSome() is still non-reactive
}