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

前端 0

gateway运行时报错


原因很明显:SpringMVC和SpringCloudGateway不共存,但是我子项目pom文件根本没有spring-boot-starter-web,是从父项目继承过来的


解决方法①:在application.yml添加spring.main.web-application-type=reactive

格式如图

解决方法②:用exclusions排除spring-boot-starter-web依赖

        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-web</artifactId>            <exclusions>                <exclusion>                    <groupId>*</groupId>                    <artifactId>*</artifactId>                </exclusion>            </exclusions>        </dependency>

也许您对下面的内容还感兴趣: