Consider defining a bean of type ‘org.springframework.http.codec.ServerCodecConfigurer‘ 已解决

目录

绊脚石

巧妙化解

解决


绊脚石

搭建完gateway,启动程序,爆下面错误~

心里那叫一个苦啊~

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method modifyResponseBodyGatewayFilterFactory in org.springframework.cloud.gateway.config.GatewayAutoConfiguration 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.


Process finished with exit code 1

巧妙化解

一顿操作后发现:

  • 在类路径上找到Spring MVC,目前与Spring Cloud Gateway不兼容。请删除spring-boot-start -web依赖。

解决

移除springboot移除web依赖

        
            org.springframework.boot
            spring-boot-starter-web
        
        
            org.springframework.boot
            spring-boot-starter-actuator
        

至此,你又可以放飞自我了!

Consider defining a bean of type ‘org.springframework.http.codec.ServerCodecConfigurer‘ 已解决_第1张图片Consider defining a bean of type ‘org.springframework.http.codec.ServerCodecConfigurer‘ 已解决_第2张图片

你可能感兴趣的:(Java成神秘籍,http,网络协议,网络,java,后端,spring,cloud,gateway)