O'Reilly logo

Reactive Programming With Java 9 by Tejaswini Mandar Jog

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Annotation-based support

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required