跳到主要内容

如何包含 Spring Cloud Gateway 服务器 MVC

DeepSeek V3 中英对照 How to Include Spring Cloud Gateway Server MVC

要在项目中包含 Spring Cloud Gateway Server MVC,请使用组 ID 为 org.springframework.cloud、工件 ID 为 spring-cloud-starter-gateway-mvc 的 starter。有关使用当前 Spring Cloud Release Train 设置构建系统的详细信息,请参阅 Spring Cloud 项目页面

如果你包含了 starter,但不想启用网关,可以将 spring.cloud.gateway.mvc.enabled 设置为 false

important

Spring Cloud Gateway Server MVC 基于 Spring BootSpring WebMvc.fn 构建。因此,当你使用 Spring Cloud Gateway Server MVC 时,许多异步或响应式库可能不适用。

important

Spring Cloud Gateway Server MVC 可以与传统的 Servlet 运行时(如 Tomcat 和 Jetty)一起工作。