如何引入 Spring Cloud Gateway Server MVC

"
"

要在你的项目中引入 Spring Cloud Gateway Server MVC,使用 group ID 为 org.springframework.cloud,artifact ID 为 spring-cloud-starter-gateway-mvc 的启动器依赖。有关使用当前 Spring Cloud Release Train 设置构建系统的详细信息,请参阅 Spring Cloud Project 页面。

要在你的项目中引入 Spring Cloud Gateway Server MVC,使用 group ID 为 org.springframework.cloud,artifact ID 为 spring-cloud-starter-gateway-mvc 的启动器依赖。有关使用当前 Spring Cloud Release Train 设置构建系统的详细信息,请参阅 Spring Cloud Project 页面

如果你引入了启动器依赖但不想启用网关,可以设置 spring.cloud.gateway.mvc.enabled=false

重要

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

重要

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