【问题标题】:Which is the best way for the routs uri in spring boot except zuul and spring cloud gateway除了zuul和spring cloud gateway之外,哪个是spring boot中路由uri的最佳方式
【发布时间】:2022-06-10 20:20:29
【问题描述】:

我在我的基于 Spring Boot 微服务的项目中将 Spring Boot 1.3.7.RELEASE 升级到 2.5.12 和 Spring Framework 5.3.18,当我无法添加 zuul 依赖项时,我们已经成功升级了除网关服务之外的所有服务,因为它的维护模式是为什么我们实现了 Spring Cloud Gateway,然后我遇到了以下问题。

***************************
APPLICATION FAILED TO START
***************************

Description:

Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway.

Action:

Please set spring.main.web-application-type=reactive or remove spring-boot-starter-web dependency.

为了最好的方式,我们需要做什么?

【问题讨论】:

  • 网关不兼容spring MVC only webflux
  • @spencergibb 我们可以解决路由问题的任何替代解决方案。
  • @spencergibb 我们已经修复了使用 Spring Cloud Gateway 进行路由的问题。

标签: spring-boot hibernate spring-mvc microservices spring-cloud


【解决方案1】:

我们已经修复了使用 spring 云网关的路由问题。

请在 pom.xml 中添加依赖

<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> </dependency>

bootstrap.yml

spring:main:web-application-type:reactive

感谢大家的支持。

【讨论】:

    猜你喜欢
    • 2020-10-25
    • 2023-04-02
    • 2019-08-03
    • 2020-06-01
    • 1970-01-01
    • 2019-10-01
    • 2017-12-02
    • 2016-08-31
    • 2017-11-13
    相关资源
    最近更新 更多