springcloud gateway异常:required a bean of type ‘org.springframework.http.codec.ServerCodecConfigurer
springcloud gateway异常错误:required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer解决方法
1.异常信息:
2025-04-23T13:00:13.065+08:00 WARN 13224 --- [wemedia-oss-gateway] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gatewayConfiguration' defined in file [D:\ideawork\wemedia-oss\wemedia-oss-gateway\target\classes\com\wemedia\gateway\config\GatewayConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 1: No qualifying bean of type 'org.springframework.http.codec.ServerCodecConfigurer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2025-04-23T13:00:13.066+08:00 INFO 13224 --- [wemedia-oss-gateway] [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2025-04-23T13:00:13.078+08:00 INFO 13224 --- [wemedia-oss-gateway] [ main] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-04-23T13:00:13.090+08:00 ERROR 13224 --- [wemedia-oss-gateway] [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of constructor in com.wemedia.gateway.config.GatewayConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration.
2.原因分析:gateway的底层是webflux,和springboot的web依赖只能存在一个
3.解决方法:删除springboot web模块的依赖

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)