Spring 5.0 Projects
上QQ阅读APP看书,第一时间看更新

Reactive support in Spring Framework

Spring is a modular framework and used to build every aspect of an application from the web to the persistence layer. Each module is considered as a sub-framework and targeted for a specific area of development. For example, to support a web layer with a servlet API,  the Spring MVC module was included in the Spring Framework. 

Similarly, to support a reactive stack in the web layer, Spring WebFlux was introduced in Spring Framework 5. It is fully non-blocking, backpressure, asynchronous, and compliant with Reactive Streams specifications. It can be run on Servlet 3.1+, Netty, and Undertow containers.

Spring Framework has both the stacks, Spring Web MVC and spring-WebFlux, and developers are free to use either of them, or in some scenarios to mix both of them to develop a Spring-based web application. The typical example would be using spring MVC controller with reactive WebClient; we will talk more about this in the latter part of this chapter.