【翻译】Spring 5 WebFlux入门
【推荐阅读】微服务还能火多久?>>> 原文链接: Guide to Spring 5 WebFlux | Baeldung 1. 概览 Spring WebFlux 框架是 Spring 5的一部分,他为 web 应用提供了响应式编程的支持。 在本文中,我们将使用响应式注解*RestController*和*WebClient*创建一个小的 REST 应用, 我们还将研究如何使用Spring Security保护我们的响应式端点。 2. Spring WebFlux 框架 ** Spring WebFlux内部使用Project Reactor及其发布者实现 - Flux和Mono。** 这个新框架支持下面两种编程模型: - 基于注释的响应式组件 - 函数级别的路由和处理 在这里,我们将重点关注基于注释的响应式组件,正如我们已经研究过的[functional style – routing and handling]( Introduction to the Functional Web Framework in Spring 5 | Baeldung ). 3. 依赖 让我们从spring-boot-starter-webflux依赖开始,它包含了所有其他必需的依赖: 用于基本Spring Boot应用程序设置的spring-boot和spring-boot-starter