At the core of developing scalable web applications is a thorough knowledge of reactive programming. In this course, Spring WebFlux: Getting Started, you will learn the foundations of reactive programming and Spring WebFlux. First, you will learn exactly what reactive programming is and why it's so useful. Then, you will see how to work with Spring WebFlux’s annotated controllers and functional endpoints to process large amounts of data. Finally, you will use WebClient to create reactive web clients, and also set up integration testing with WebTestClient. When you’re finished with this course, you will have a foundational knowledge of reactive programming with Spring WebFlux that will help you as you move forward to build scalable web applications.
Course Overview Hi everyone. My name is Esteban Herrera. Welcome to my course Spring WebFlux: Getting Started. I have been working with Java for more than 10 years. I love the language and teaching all I know about it. The number of Internet users has increased dramatically in the recent years. Now, we have applications that must process big volumes of data and respond almost immediately to users. Reactive web applications promise to be the answer to these new requirements. In this course, you are going to learn about reactive programming and the Spring WebFlux as an alternative way of developing web applications. Some of the major topics that we will cover include reactive programming with Project Reactor, how to work with annotated controllers, how to work with functional endpoints, how to execute requests with WebClient, and how to set up integration tests with web Test Client. By the end of this course, you'll understand the basics of Spring WebFlux and reactive programming to create web applications. Before beginning the course, you should have at least a basic knowledge of Spring framework, Spring MVC, Lambda expressions, and method references. I hope you'll join me on this journey to learn Spring WebFlux with the Spring WebFlux: Getting Started course at Pluralsight.
Learning Reactive Programming with Reactor This module is an introduction to Project Reactor. You'll learn the essential things about Reactor and Reactive Streams to work with Spring WebFlux. First, I'll show you the interfaces from the Reactive Stream specification that Reactor implements and how they work. Next, I'll talk about the main classes of Project Reactor, Flux and Mono. Next, we'll set up a project to demonstrate how to create and use Flux, Mono, and some operators of Reactor. So let's get started.
Building a REST API with Annotated Controllers In this module, you'll learn how to build a REST API using Spring WebFlux and annotated controllers. The API will be based on the following scenario. Imagine we are working for a company named Wired Brain Coffee. This company owns a chain of successful coffee shops across the country. Now, the company needs to expose its catalog of products as a REST API so other systems can use it. The IT department of this company has heard that using a non-blocking, asynchronous programming model makes the application easy to scale and support many concurrent users without the need of powerful hardware. With the API, other systems will be able to get all products, get a specific product, register a new product, update a product, delete a product, and delete all products. In addition, we'll simulate a stream of events that will be pushed to the clients of the API at a regular interval using sever-side events. So here's the plan for this module. First, I'll cover a few things about how annotated controllers work with reactive types. Next, I'll show you how to use Spring Initializer and Spring Boot to bootstrap a Spring WebFlux application. Then, we'll start coding the MongoDB repository using Spring Data so we can insert some initial data in an embedded database when the application starts. Next, we'll build a controller, all the methods to create, read, update, and delete resources. And finally, we'll implement the server-side events.
Building a REST API with Functional Endpoints In this module, you'll learn how to build a REST API using Spring WebFlux functional endpoints. The API will be based on the same scenario of the module Building a REST API with Annotated Controllers. It's the same API, but now it will be implemented with functional endpoints. I'll cover how to set up the project with Spring Initializr, configure the embedded database, and insert some initial data. It's exactly the same process as the one used in the annotated controllers module, but I cover it at a faster pace. Feel free to escape this if you already know how to do it by yourself or, if you're not already comfortable with the process, watch it and go back to the other module if you need more context or information. Anyway, you'll learn how to build the handler functions that will take care of the request. Then, I'll cover how to build the router functions and how to hook them up with the handler functions. Are you wondering what a handler function or a router function is? Let's start with these concepts.
Building an API Client with WebClient In this module, you're going to learn about WebClient, a reactive HTTP client introduced in Spring 5. First, I'll talk about how to work with this API. Then, I'll show you how to set up a project with Maven to use WebClient. And finally, I'll show you how to build a client for the product API you built in the modules Building an API with Annotated Controllers and Building an API with Functional Endpoints. So let's get started.
Testing WebFlux Endpoints with WebTestClient In this module, you're going to learn how to use WebTestClient, a non-blocking reactive client for testing web servers. WebTestClient has almost the same API as WebClient. I'll show you how to create an instance with and without an HTTP server and how to verify that the response is correct. Then, you'll build integration tests with JUnit 4 and 5 to test the annotated controller developed in the module Building a REST API with Annotated Controllers and the router function developed in the module Building a REST API with Functional Endpoints. Don't worry if you don't know JUnit. I'll give you the instructions to set it up and create test cases. So let's get started.