
Explore reactive programming with Spring WebFlux, building a non-blocking Spring Boot REST API. Learn database access, security with JWT, and method-level authorization for reactive applications.
Review traditional Spring MVC blocking applications built with Spring Web MVC, including the three-layer architecture (presentation, service, data), synchronous requests, and Rest controllers returning JSON or XML.
Examine how traditional spring mvc runs a blocking thread-per-request model on tomcat, where threads wait on external calls and database reads, revealing a 200-concurrent-request limit and scalability implications.
Explore solutions to the thread per request problem, including vertical and horizontal scaling, virtual threads with Java, and reactive programming with non-blocking input and output for many concurrent requests.
Learn how the Spring framework enables reactive non-blocking applications using Spring WebFlux, Project Reactor, and the Mono and Flux types, as defined by the Reactive Streams specification.
Discover reactive programming to build non-blocking applications that handle both asynchronous and synchronous operations, using data streams, propagation of change, and functional style.
Explore data streams in reactive applications, where publishers emit items to subscribers one by one. Learn how non-blocking, memory-efficient streaming uses subscription, request, on next, and backpressure to control flow.
Learn how back pressure lets subscribers control data from publishers with the request method, specifying how many items to receive, reducing memory pressure when fast publishers overwhelm slow subscribers.
Demonstrate reactive data streams by creating a simple subscriber and logging publisher-subscriber interactions using flux, subscribe, and log operator in a Spring WebFlux context.
Discover how reactive Spring Boot replaces blocking with non-blocking communication, asynchronous data streams, and event-driven architecture using Spring Web Flux and reactive repositories.
Create a new reactive Spring Boot microservice using Spring Webflux, via start.spring.io with Maven and Java, add Spring Reactive Web dependency, generate, download, unzip, and import into IntelliJ.
Configure a reactive Spring Boot microservice to use an H2 in-memory database for development, with R2DBC support and the H2 driver.
Configure a spring webflux app to create a users table using a schema.sql file and preview it in the H2 web console, with spring.sql.init.mode controlled for embedded H2.
Start a Spring Boot microservice, access the H2 web console, and log in with credentials from application.properties to view the users table in the Testdb database.
Explore the presentation layer of a reactive spring boot app by building Rest controllers, handling HTTP requests, and converting JSON to Java objects while validating input and ensuring non-blocking responses.
Create a new rest controller class in the presentation package named Usercontroller, annotate it with RestController and RequestMapping to set the base path /users.
Define a Java method to handle http post requests at /users using a post mapping annotation, enabling post requests to localhost:8080/users and preparing to read the request body.
Learn to read the HTTP request body in Spring WebFlux using @RequestBody and Mono, deserializing a JSON payload into a CreateUserRequest with first name, last name, email, and password.
Validate http request bodies in spring applications using jakarta bean validation annotations such as not blank, size, and email, and surface error messages in json responses.
Test bean validation in a reactive pipeline by removing mono, running the app, and sending valid and invalid JSON to observe 200 and 400 responses with binding errors.
Learn how to return a reactive, non-blocking http response by emitting a Mono of string, using Project Reactor's Mono and just to emit a single value.
Learn reactive programming with spring webflux by returning a user rest object in an HTTP response via Mono, using map to expose id, first name, last name, and email.
Learn to return custom http status codes in a Spring WebFlux endpoint using response status and response entity with Mono and map, including a location header for created resources.
Create a non-blocking get endpoint using @GetMapping to retrieve user details by id from the url path, returning a Mono of user rest with hardcoded data.
Create a non-blocking Spring WebFlux endpoint that returns multiple users using Flux, exposed by a get request to /users, returning a JSON array and contrasting Getusers with Getuser.
Learn to read url query string parameters for pagination by reading offset and limit with request param annotation, supplying default values, and using these to fetch data in pages.
Build the data layer for a reactive Spring Boot app by updating the schema, creating an entity class, and a repository interface to handle non-blocking database operations.
Update the schema sql file to define a users table with first_name, last_name, email (unique, varchar 100), and password (encrypted); prepare the data layer for storing user details.
Create a user entity class to map to the users table with spring data r2dbc, including id, first name, last name, email, and password fields, using table and column annotations.
Create a user repository interface by extending reactive Crud repository to enable non-blocking write and read of user details using spring data rtc, with mono and flux return types.
Build a non-blocking, reactive Spring Boot app by implementing the service layer with core business logic and dependency injection to support create, get, and get all users in the controller.
Create a service class in service layer that implements user service interface with create user method accepting a create user request and returning a user rest object, annotated with @Service.
Implement the createUser method in a reactive Spring WebFlux app by converting the create user request to a user entity, persisting via the user repository, and returning a user rest.
Wires the Rest controller to the service layer via constructor injection and invokes create user; maps Mono to a created ResponseEntity with location.
Run the app, create a new user via Postman, and verify stored details in the H2 database, noting the need to encrypt passwords in future security work.
Implement a non-blocking get user by id, fetch from database, map to user rest, and return HTTP response with 200 or 404 using mono and switchIfEmpty.
Run the Spring Boot microservice, seed the H2 in-memory database by creating a user in Postman, then use the get user details endpoint with the user id.
Learn to implement a reactive find all with pagination in a Spring WebFlux app by extending the user repository with a Flux-based method using Pageable.
Develop a reactive find all method in the user service that returns a flux of user rest objects with page and limit-based pagination in Spring WebFlux.
Update the rest controller to return a paginated, non-blocking list of users using the service's findAll(page, limit). Emit user rest objects via Flux as data becomes available.
Run a spring webflux reactive app, create users with postman, and fetch paginated users via get /users, using zero-based page indexing.
Learn to handle exceptions in reactive Spring Boot microservices using the onErrorMap operator, transforming a duplicate key exception into a custom HTTP response with status 409 and the original message.
Update the onErrorMap operator to intercept multiple exceptions with a throwable lambda, detect duplicate key and data integrity violation errors via instanceof, map to http status codes, enabling centralized handling.
Learn to implement global exception handling in Spring Boot using controller advice or rest controller advice annotations, creating centralized, uniform error responses across controllers. Understand centralized error handling and maintainability.
Implement a global exception handler in a reactive Spring WebFlux REST app with @RestControllerAdvice and @ExceptionHandler, handling duplicate key and general exceptions via Spring six error response wrapped in Mono.
Learn how controller advice handles exceptions in a Spring WebFlux app by triggering a duplicate key error and inspecting the configured error response fields (type, title, status, detail, instance).
Validate custom bean validation error responses in Spring WebFlux by running the app, sending a create user request with short names, and observing concatenated, comma-separated error messages.
Add Spring Security and Spring Security Test dependencies to a reactive Spring WebFlux app via Spring Initializer and pom.xml, enabling secure API endpoints by default.
Learn to configure web flux security by creating a security web filter chain bean, enabling web flux security, and exposing public endpoints (like user creation) while protecting others.
Configure reactive Spring WebFlux security to allow unauthenticated post /users for user registration, using authorizeExchange to set access rules, and disable CSRF for stateless REST microservices using JWT.
Run the application, test the spring security configuration by creating a new user, and observe that listing users returns 401 unauthorized due to protected endpoints.
In this video course you will learn how to create Reactive and Non-blocking applications with Spring WebFlux framework.
This course is perfect for beginners and will start with the basics of Spring WebFlux.
You will learn:
- What Reactive programming is and how it is different from an imperative programming style,
- The key differences between the traditional, blocking Spring WebMVC and the non-blocking, Reactive Spring WebFlux applications,
- To create reactive RESTful Web Service application that handles different types of HTTP requests,
- Write and read information from a database in a reactive, non-blocking way.
As you progress through the course, you will learn how to:
- Use Spring Security to protect your Spring WebFlux application,
- Implement user login(authentication),
- Generate and use JSON Web Tokens (JWT) for secure communication
- Validate JWT and read token claims,
- Use method-level security annotations to perform authorization.
You will also learn how to add pagination and read database records in smaller chunks to improve performance.
All important concepts are explained using simple, easy-to-follow slides. The source code is provided, so you can download it and follow along with each lesson.
This course also includes helpful quiz questions to test your knowledge as you go. Plus, there is an active Q&A section where you can get answers to all your questions
By the end of this course, you’ll be able to create fast, secure, and scalable Reactive applications with Spring WebFlux.