gateway启动报错 org.springframework.http.codec.ServerCodecConfigurer that could not be found

问题:

启动时报错:

1
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.

原因:

  因为gateway的底层是webflux,和springboot的web依赖只能存在一个

解决方法:

  删除springboot web模块的依赖

1
2
3
4
<!--        <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-web</artifactId>-->
<!-- </dependency>-->
如果你觉得有帮助,慷慨如你,可以扫描下面的二维码赞赏一下