解决引入spring-cloud-starter-gateway后启动项目:Spring MVC found on classpath, which is incompatible with Spri
解决引入spring-cloud-starter-gateway后启动项目:Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.
- 按照错误的提示信息为jar包冲突导致因为gateway包内含有starter-web包所以首先需要检查父目录是否包含有则删除
- 基本解决思路
按照错误的提示信息为jar包冲突导致因为gateway包内含有starter-web包所以首先需要检查父目录是否包含有则删除
1.在gateway模块中: gateway依赖中 将gateway中的“spring-boot-starter-webflux” 去掉可以编译成功 ,可以编译成功
<!--引入gateway 网关--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId><!--排除gateway 内部不兼容的 spring-webflux --><exclusions><exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webflux</artifactId></exclusion></exclusions></dependency>
2.在排除后发现启动报错没有了webflux 依赖,所以又需要引入:
<dependency><groupId>org.springframework.bootgroupId><artifactId>spring-boot-starter-webfluxartifactId><version>2.1.8.RELEASEversion>dependency>
3.此时报错又会回到初始的: 需要移除starter-web的依赖所以撤回前两部操作完全无用:
4.如果父目录已经排除starter-web还是同样错误那检查父目录的:
org.springframework spring-webmvc 5.3.1
删除这个spring-mvc依赖完美解决问题
基本解决思路
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
