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

记录一下在使用Spring Cloud Gateway时,其中使用RPC框架 dubbo集成nacos做远程调用中出现的问题
参考该文章 blog
使用Spring Boot 2.7.6、Spring Cloud 2021.1.9版本、Dubbo 3.0.9 Nacos 2.1.2.、Gateway3.1.6
启动项目之后出现如下错误:

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

看提示应该是在Spring Boot整合GateWay时,
GateWay组件中的 【spring-boot-starter-webflux】 和
springboot作为web项目启动必不可少的 【spring-boot-starter-web】 出现冲突,网上查阅资料有建议在pom中移除一个spring-boot-starter-web,尝试了还是不行,后面通过在配置文件添加如下配置解决:

spring:
  main:
    web-application-type: reactive

猜你喜欢

转载自blog.csdn.net/weixin_45765073/article/details/129813548
今日推荐