Spring WebFlux is Spring’s reactive web framework for building web applications and APIs around nonblocking, asynchronous request handling. Event loops can continue serving other requests while costly operations run through callbacks, improving scalability under heavy request volume with fewer threads. section 12.1 section 12.0
WebFlux fits into Spring applications through several practical design choices:
- Uses a separate reactive framework rather than adding reactive branching to Spring MVC. section 12.1.1
- Shares many Spring MVC annotations, so familiar controller patterns remain recognizable. section 12.1.1
- Builds on a Reactive HTTP API instead of the Servlet API and can run on nonblocking containers such as Netty, Undertow, Tomcat, or Jetty. section 12.1.1
- Starts through the Spring Boot spring-boot-starter-webflux dependency. section 12.1.1
Spring Boot dependency
Add the WebFlux starter to a Spring Boot build:\n\n<dependency>\n <groupId>org.springframework.boot</groupId>\n <artifactId>spring-boot-starter-webflux</artifactId>\n</dependency> section 12.1.1
Figure 12.1 Asynchronous web frameworks apply event looping to handle more requests with fewer threads.
Use the event-loop figure to visualize how asynchronous web frameworks handle more requests with fewer threads. section 12.1
