liveBook · Manning

Spring Reactive Web

As explained in Spring in Action, Sixth Edition

Spring WebFlux is Spring's reactive web framework for building web applications that process requests and responses using reactive programming.

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

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains event-loop motivation, framework architecture, containers, dependency setup, controllers, clients, testing, and security.
Examples
Uses reactive controllers, the WebFlux starter dependency, WebClient, WebTestClient, and nonblocking web containers.
What it assumes
Assumes familiarity with Spring REST controllers, then builds on reactive programming and Project Reactor.
What you can do after
Build it from scratch with Spring Boot, then test reactive controllers and consume REST APIs with WebClient.
How it connects
Connects Spring MVC, Project Reactor, Reactive HTTP API, WebClient, WebTestClient, and Spring Security.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.