Skip to content

我最近再重新学习WebFlux的基础知识,巩固一下细节,也写一个入门教学,供小白们使用,每周更新,喜欢请加Star!

License

Notifications You must be signed in to change notification settings

kangchainx/java-webflux-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java WebFlux Tutorial Banner

Java WebFlux Tutorial 🚀 (Java WebFlux 教程 🚀)

A step-by-step tutorial to learn Spring WebFlux from basics to advanced usage, focusing on real-world reactive programming techniques.
一个循序渐进的教程,从基础到进阶系统地学习 Spring WebFlux,并掌握真实场景下的响应式编程技巧。

Future chapters may explore real-time streaming scenarios such as integrating CEX market data or WebSocket-based data services.
后续章节可能会探索诸如集成 CEX 行情数据或基于 WebSocket 的实时数据服务等流式场景。


✅ What You Will Learn (你将学到什么 ✅)

  • Reactive programming with Mono & Flux (基于 Mono 和 Flux 的响应式编程)
  • Build reactive REST APIs (构建响应式 REST API 接口)
  • Use WebClient for async HTTP/WebSocket (使用 WebClient 进行异步 HTTP/WebSocket 通信)
  • Stream real-time data via SSE / WebSocket (通过 SSE / WebSocket 推送实时数据流)
  • Handle retry, reconnection, and backpressure (处理重试、断线重连和背压)
  • Design scalable reactive architectures (设计可扩展的响应式架构)

🧠 Why WebFlux? (为什么选择 WebFlux?)

Traditional Spring MVC uses blocking I/O and one thread per request. (传统 Spring MVC 使用阻塞式 I/O,并为每个请求分配独立线程。)

Spring WebFlux is non-blocking, event-loop-based, and highly scalable. (Spring WebFlux 是非阻塞、基于事件循环的,并且具有极高的可扩展性。)

Perfect for real-time, high-concurrency, and streaming data scenarios. (非常适合实时、高并发和流式数据场景。)


🛠 Tech Stack (技术栈)

  • Java 21
  • Spring Boot 3+
  • Spring WebFlux (Reactor)
  • Mono & Flux (Reactive Streams)
  • WebClient
  • WebSocket / SSE

📂 Project Structure (Multi-Module) (项目结构(多模块))

java-webflux-tutorial
├── chapter01-hello-webflux # Basic WebFlux example
├── chapter02-mono-flux # Coming soon
└── ...

Each chapter is an independent runnable module with focused content. (每个章节都是独立可运行的模块,聚焦于一个知识点。)


📘 Chapters (章节目录)

Chapter Description 状态
01 - Hello WebFlux Basic reactive endpoint using @RestController
使用 @RestController 构建基础响应式接口
✅ Completed
02 - Mono & Flux (Coming soon) Reactive types and core concepts
响应式类型与核心概念
⏳ In Progress

📦 Example: chapter01-hello-webflux structure (示例:chapter01-hello-webflux 目录结构)

chapter01-hello-webflux
├── src
│ └── main
│ ├── java
│ │ └── com.kangchain.webflux.chapter01
│ │ ├── HelloWebFluxApplication.java
│ │ └── controller
│ │ └── HelloController.java
│ └── resources
│ └── application.yml
└── pom.xml

Clean and simple structure for quick start.
结构清晰简单,便于快速上手。


🤝 Contributing (参与贡献)

This project is evolving chapter by chapter. Suggestions and PRs are welcome!
本教程将持续按章节推进,欢迎提交建议或 Pull Request!


📄 License (许可证)

MIT License © KangChain


⭐ Support (支持项目)

If this project is helpful, please give it a star ⭐ to support!
如果你觉得这个项目对你有帮助,请点亮一个 star ⭐ 以示支持!

Let’s learn WebFlux and build something amazing together! 🚀
让我们一起学习 WebFlux,并构建出有价值的项目!🚀

About

我最近再重新学习WebFlux的基础知识,巩固一下细节,也写一个入门教学,供小白们使用,每周更新,喜欢请加Star!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages