admin管理员组文章数量:1794759
关于gateWay配置问题 Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this
今天配置Gateway网关的时候发现 报了这样一个问题Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.
我去检查pom文件的时候发现spring-boot-starter-web 已经去掉了。但是启动还是报错,只能手动排除了,所以添加了下面的依赖。
<exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> </exclusion> </exclusions>解决~ 但是访问网关地址的时候,又报了这样一个问题
org.springframework.core.io.buffer.DefaultDataBufferFactory cannot be cast to org.springframework.core.io.buffer.NettyDataBufferFactory
java.lang.ClassCastException: org.springframework.core.io.buffer.DefaultDataBufferFactory cannot be cast to org.springframework.core.io.buffer.NettyDataBufferFactory
大概的意思就是 springcloud的gateway使用的是webflux,默认使用netty,所以要从依赖中排除 tomcat相关的依赖 ,就可以了。
所以完整的依赖应该是
<exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> </exclusion> </exclusions>
本文标签: MVCspringGatewayclasspath
版权声明:本文标题:关于gateWay配置问题 Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686619226a87007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论