Moment For Technology

Getting started with Spring WebFlux

Posted on Oct. 20, 2023, 2:38 p.m. by Stewart Pugh
Category: The back-end Tag: The back-end


Those who are good at English are advised to read the official documents directly.

Spring WebFlux is a new responsive Web Framework introduced in Spring Framework 5.0. Unlike Spring MVC, it does not require a Servlet API, is fully asynchronous and non-blocking, and implements the Reactive Streams specification through the Reactor project. Spring WebFlux is used to create completely asynchronous and non-blocking applications based on the event loop execution model.

Reactive Streams is a set of specifications for building high-throughput, low-latency applications. The Reactor project is based on the implementation of this specification, which is a completely non-blocking foundation that supports back pressure. Spring WebFlux is a responsive stack that implements a fully asynchronous, non-blocking web framework based on Reactor.

【 Spring-webmvc + Servlet + Tomcat】 imperative, synchronous blocking

Spring - WebFlux + Reactor + Netty

Spring MVC or WebFlux?

The official website gives a picture and we need to consider the selection of some suggestions

Personal understanding mainly depends on the specific business scenarios and the internal technology stack of our own RD team, because most of the scenarios are blocking mode, and we have been accustomed to this mode, so we need to consider the cost of switching to responsive programming learning.

Spring WebFlux Framework

Let's write a simple application to try it out. We can create a new WebFlux application directly in Idea.

Spring WebFlux comes in two styles: functional and annotation-based. Annotation based is very similar to Spring MVC

Start the application and access it directly in the browser, or relatively easy

The last

Well, this article is introduced here, and then some of its core principles and features will be introduced in detail. IO /projects/sp...

About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.