如何引入 Spring Cloud Gateway

要在您的项目中引入 Spring Cloud Gateway,请使用组 ID 为 org.springframework.cloud、Artifact ID 为 spring-cloud-starter-gateway 的 Starter。有关使用当前的 Spring Cloud Release Train 设置构建系统的详细信息,请参阅 Spring Cloud 项目页面

如果您引入了 Starter,但不想启用网关,请设置 spring.cloud.gateway.enabled=false

Spring Cloud Gateway 基于 Spring BootSpring WebFluxProject Reactor 构建。因此,在使用 Spring Cloud Gateway 时,许多您熟悉的同步库(例如 Spring Data 和 Spring Security)和模式可能不适用。如果您不熟悉这些项目,我们建议您在开始使用 Spring Cloud Gateway 之前先阅读它们的文档,熟悉一些新概念。
Spring Cloud Gateway 需要由 Spring Boot 和 Spring Webflux 提供的 Netty 运行时。它不能在传统的 Servlet 容器中工作,也不能构建成 WAR。