WebFlux supports annotation from the Spring Web MVC module with one major difference in the contract. Now, HandlerMapping and HandlerAdapter are non-blocking and operate on reactive ServletRequest and ServletResponse instead of HttpServletRequest and HttpServletResponse.
We usually return java.util.List, Object, String, or primitives from the controllers in Spring. Now, as Spring supports Reactive Programming, we need to know how to add reactive data types in the request or response. We can use the reactive types as discussed in the following scenarios:
- Mono<Employee> employee: This controller can use Mono after the employee is deserialized
- Single<Employee> employee: This is similar to Mono in the RxJava style