当前位置: 首页 >服务端 > gateway启动报错:org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found

gateway启动报错:org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found

将pom.xml中关于spring-boot-start-web模块的jar依赖去掉。

错误分析:

根据上面描述(Description)中信息了解到GatewayAutoConfiguration这个配置中找不到ServerCodecConfig这个Bean。

spring cloud gateway server项目是一个spring boot项目,在启动的时候会去加载它的配置,其中有一个叫做GatewayClassPathWaingAutoConfiguration的配置类中有这么一行代码:

@Configuration@ConditionalOnClass(name = "org.springframework.web.servlet.DispatcherServlet")protected static class SpringMvcFoundOnClasspathConfiguration {public SpringMvcFoundOnClasspathConfiguration() {log.wa(BORDER+"Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. "+"Please remove spring-boot-starter-web dependency."+BORDER);}}

  


 在类路径上找到的Spring MVC,此时它与Spring Cloud网关不兼容。请删除spring-boot-start-web依赖项。

因为spring cloud gateway是基于webflux的,如果非要web支持的话需要导入spring-boot-starter-webflux而不是spring-boot-start-web。

作者:小破天
来源链接:https://www.cnblogs.com/xiaopotian/p/10944832.html

版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaclub.cn/server/112336.html

标签:Gateway
分享给朋友:

“gateway启动报错:org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found” 的相关文章

go系列之利用Gin框架获取form参数 2022年05月15日 02:49:59
Java 日志框架详解 2022年05月19日 20:04:12
Java日志框架那些事儿 2022年05月19日 20:04:37
中间件RabbitMQ 2022年05月23日 16:45:42
如何学习一门语言 2022年05月23日 21:03:30
信息系统项目管理师之风险管理 2022年05月24日 23:52:04
博客构建工具推荐(文本送书) 2022年05月26日 22:30:23
炒冷饭系列:设计模式 装饰模式 2022年05月26日 23:29:24