搭建springcloudGateway的时候启动类启动的报错
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.
网上查说:父工程的依赖spring-boot-starter-web,因为会与网关模块微服务spring cloud gateway的webflux冲突,排除springboot-start-web
在网关微服中引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope> <!-- 特殊处理,不引入父类lib -->
</dependency>
加入后可以通过网关路由到微服务了
test(测试范围)
scope为test表示依赖项目仅仅参与测试相关的工作,包括测试代码的编译,执行。比较典型的如junit。test表示只能在src下的test文件夹下面才可以使用,
感觉最终比较好的解决方式是,找父工程不引入spring-boot-starter-web,只在需要的模块引入就行