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

Record the problems that arise when using Spring Cloud Gateway and using the RPC framework dubbo to integrate nacos for remote calls.
Refer to this article. The blog
uses Spring Boot 2.7.6, Spring Cloud 2021.1.9 version, Dubbo 3.0.9 Nacos 2.1.2. ,
The following error occurs after starting the project with Gateway3.1.6 :

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

The prompt should be that when Spring Boot integrates GateWay, there is a conflict between
[spring-boot-starter-webflux] in the GateWay component and
[spring-boot-starter-web], which is essential for springboot to start a web project. Check the information online. It is recommended to remove a spring-boot-starter-web in the pom, but it still doesn’t work. Later, the solution is solved by adding the following configuration to the configuration file:

spring:
  main:
    web-application-type: reactive

Guess you like

Origin blog.csdn.net/weixin_45765073/article/details/129813548