Request and response body conversion
Conversion is required in the case of a Reactive web application . The spring core module provides reactive Encoder and Decoder to enable the serialization of a Flux of bytes to and from the typed objects.
Let's see the following example for request body type conversions. Developers do not need to forcefully do type conversion--the Spring Framework automatically converts it for you in both types of approaches: Annotation-based programming, and functional-based programming.
- Account account: This means that the account object is deserialized before the controller is called without blocking.
- Mono<Account> account: This means that
AccountController
can use the Mono to declare logic. The account object is first deserialized, and then this logic is executed. - Flux<Account> accounts: This means that
AccountController
can use Flux in case of the input streaming scenario. - Single<Account> account: This is very similar to the Mono, but here the Controller...