Consider the following example,
@RestController
public class MyController {
private final MyService service;
public MyController(MyService service) {
this.service = service;
}
@GetMapping
public Mono<MyObject> endpoint(String id) {
String newId = String.toLowerCase()
Mono.just(service.getObject(newId));
}
}
All of the logic from the repository, to the service, & to any another class interactions don't deal with Mono's or Flux's. In this example, the service method getObject
returns a MyObject data type which isn't wrapped in a Mono.
So, is there really a purpose to using webflux or a reactive approach in general with this setup or are we actually still getting benefit from using this Mono publisher type ?