Spring 5 supports dealing with Reactive Programming with the addition of a new module named spring-webflux. It uses the Servlet 3.1 non-blocking I/O, which can be run on the Servlet 3.1 container. ServletHttpRequest and ServletHttpResponse expose Flux<DataBuffer> as the request and response body to allow reading and writing of streams. The Spring MVC API is defined in such a way that it is able to support asynchronous and non-blocking I/Os. Spring has the following two modules which add server-side WebFlux support:
- Annotation based support: The annotations facilitated by Spring Web MVC such as @Controller, @GetMapping, and @PostMapping are now supported to handle reactive types
- Lambda expression style: Functional Java 8 lambda expression style for routing and handling requests is supported for handling the reactive types