4
votes

In a controller I can write:

fun update(@RequestBody myPojo: MyPojo): Mono<Void> 

or

fun update(@RequestBody myPojo: Mono<MyPojo>): Mono<Void> 

is there any difference? will the body parsing be done in different threads? in first case will i block the main reactor thread until myPojo is parsed?

1

1 Answers

4
votes

There's no strong runtime difference between the two; in the first case, Spring will unwrap the incoming Mono, but the decoding will still happen asynchronously.

The only difference is that without a Mono type as an argument, you won't be able to use Reactor operators on it. So this is really about what needs to be achieved in your controller handler.