Spring WebFlux

Spring Framework 中包含的原始 Web 框架(Spring Web MVC)是专门为 Servlet API 和 Servlet 容器构建的。响应式堆栈 Web 框架(Spring WebFlux)稍后在 5.0 版中添加。它完全是非阻塞的,支持https://www.reactive-streams.org/[Reactive Streams] 反压,并且可以运行在 Netty、Undertow 和 Servlet 容器之类的服务器上。

The original web framework included in the Spring Framework, Spring Web MVC, was purpose-built for the Servlet API and Servlet containers. The reactive-stack web framework, Spring WebFlux, was added later in version 5.0. It is fully non-blocking, supports Reactive Streams back pressure, and runs on such servers as Netty, Undertow, and Servlet containers.

这两个 Web 框架都镜像它们的源模块的名称 (spring-webmvcspring-webflux),并同时存在于 Spring Framework 中。每个模块都是可选的。应用程序可以使用一个或另一个模块,在某些情况下,也可以同时使用两个模块,例如 Spring MVC 控制器与响应式 WebClient

Both web frameworks mirror the names of their source modules (spring-webmvc and spring-webflux) and co-exist side by side in the Spring Framework. Each module is optional. Applications can use one or the other module or, in some cases, both — for example, Spring MVC controllers with the reactive WebClient.