admin管理员组

文章数量:1794759

解决报错Spring MVC found on classpath, Spring Cloud Gateway at this time. Please remove spring

解决报错Spring MVC found on classpath, Spring Cloud Gateway at this time. Please remove spring

Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.

项目中出现这个报错网上差额很多方法都是说 1.排除掉spring-webmvc

<exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> </exclusion> </exclusions>

按网上的修改之后

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

我试了都不行,还是报错,报错原因就是因为还没有排除掉 我的项目中引用了一个自己定义的Module,该模块pom.xml里面导入了spring-boot-starter-web ,所以才会导致一直报错,我加的代码又没有效果

<dependency> <groupId>com.ylc.gulimall</groupId> <artifactId>gulimall-common</artifactId> <version>0.0.1-SNAPSHOT</version> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </exclusion> </exclusions> </dependency>

最后在我的代码中加入了exclusions标签,排除该jar包启动成功!

本文标签: 报错MVCclasspathcloudspring