Getting Started¶
This section is the entry point for the book. If you are new to reactive programming, start here. If you already know the basics, use it as a quick check of the foundations before moving into the more specialized chapters.
At a high level, this part is about answering three questions:
- what reactive programming is and why it matters in modern Spring apps
- how
MonoandFluxmodel asynchronous data streams - how to build a first WebFlux application, either manually or with Spring Boot
What you will cover¶
- the Reactive Streams specification and the role of Project Reactor
- the difference between imperative and reactive code
- minimal WebFlux applications built with
RouterFunctionandHandlerFunction - the same idea expressed with Spring Boot auto-configuration
- the repository examples you can run locally while reading
Suggested reading path¶
If you are new to the stack, a sensible order is:
- Reactive Streams and Spring WebFlux
- Create a WebFlux application from scratch
- Create a WebFlux application with Spring Boot
This keeps the learning curve gentle: you understand the reactive model first, then move to the Spring Boot convenience layer.
Prerequisites¶
Before you start, make sure you have:
- JDK 21 or newer
- Apache Maven 3.9+ or Gradle
- an IDE such as IntelliJ IDEA, VS Code, or Eclipse IDE
- a basic understanding of Spring and Java web development
- Docker for the database-backed examples in the repository
Running the examples¶
Every sample in the repository is an independent Maven module. You can run them one by one as you work through the book:
- clone the repository
- change into the sample directory you want to study, such as
vanilla - run it with
./mvnw spring-boot:runfor Boot-based samples - use the module's main class or
./mvnw package exec:javafor the manual wiring samples
The examples are intentionally small and independent, which makes them useful for experimentation. Once the basics are clear, the later chapters on Reactive Web, Data Operations, and Security show how these ideas work in larger applications.