Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.cloud.gateway.con
Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConf
·
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.
1.报错
1.1 报错信息
***************************
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.
1.2 报错场景
- 这个报错是当我在微服务中创建 GateWay 网关微服务完成之后,启动微服务,发现老是爆出这个错误
1.3 报错原因
- 这是因为 gateWay 工程中同时引入了 Web依赖 和 webflux依赖,或者是父工程中有Web依赖,二当前微服务中有webflux依赖,这样会出现冲突
1.4 解决冲突
- 一般创建 GateWay 微服务我们会重新创建一个 Maven工程,而不是继承父工程,因为可能会出现冲突,而且记得,不要同时引入 Web依赖 和 webflux依赖
<!--GateWay 网关-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<!--引入webflux-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
更多推荐
所有评论(0)