一、現象
微服務啓動時報錯:Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer'
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-11 14:21:30.165 ERROR 22456 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method modifyRequestBodyGatewayFilterFactory 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.
二、原因
這是由於所依賴的模塊中有 spring-boot-starter-web 的依賴,而 SpringCloudGateway 還不支持 spring-boot-starter-web
三、解決方案
將這個依賴排除