In this tutorial, we will learn about Spring WebFlux and how to build reactive REST APIs using Spring WebFlux, Spring Boot, and MongoDB database.
Reactive programming is a programming paradigm where the focus is on developing asynchronous and non-blocking applications in an event-driven form,
Reactive Streams Specification
Publisher
Subscriber
Subscription
Processor
- Project Reactor
- RxJava
- JDK 9 Flow Reactive Stream
Project Reactor
Mono and Flux Implementations
- Mono
- Flux
The Mono API allows producing only one value.
Flux: Returns 0…N elements.
The Flux can be endless, it can produce multiple values.
Mono vs Flux
Spring WebFlux Overview
- Spring WebFlux is a reactive web framework introduced in Spring Framework 5.
- It is designed to provide a reactive programming model for building web applications and APIs using Spring.
- Spring WebFlux is built on top of Project Reactor, which is a popular reactive programming library for the JVM.
- Spring WebFlux has supported Tomcat, Jetty, and Servlet 3.1+ containers, as well as on non-Servlet runtimes such as Netty and Undertow.
Reactive Database Drivers
- Reactive MongoDB driver: This driver provides reactive support for MongoDB.
- Reactive Redis driver: This driver provides reactive support for Redis, an in-memory key-value store.
- Reactive Cassandra driver: This driver provides reactive support for Cassandra.
Spring Boot + Spring WebFlux Application Architecture
Controller Layer
Service Layer
Repository Layer
Programming Models Supported by Spring WebFlux
- A traditional annotation-based model with @Controller, @RequestMapping, and other annotations that you have been using in Spring MVC.
- A brand new Functional style model based on Java 8 lambdas for routing and handling requests.
What we will build?
Here is the complete tutorial:
All Spring WebFlux Tutorials
Spring Boot WebFlux MongoDB CRUD REST API Tutorial
In this tutorial, you will learn how to build CRUD REST APIs using Spring Boot, Spring WebFlux, and MongoDB NoSQL database.Testing Spring WebFlux Reactive CRUD Rest APIs using WebTestClient
Spring WebFlux Functional Endpoints CRUD REST API Example
Unit Testing Spring WebFlux CRUD REST API using JUnit and Mockito
In this tutorial, we will learn how to unit test Spring WebFlux controller (Reactive CRUD REST APIs) using JUnit and Mockito frameworks.Continue Learning with Java Guides
Want to take your programming skills to the next level? Explore my practical Udemy courses on Java, Spring Boot, Microservices, Full-Stack Development, Docker, and Generative AI. You can also follow my structured learning roadmaps to become a professional developer.
By Ramesh Fadatare - Udemy Instructor Partner

Comments
Post a Comment
Leave Comment