Spring Cloud 错误整理

Spring Cloud 错误整理


错误1

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-cloud-starter-gateway与spring-boot-starter-web和spring-boot-starter-webflux依赖冲突
  • 解决
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-gateway</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </exclusion>
    </exclusions>
</dependency>
  • 注意
    虽然问题解决后项目可以启动了,可是gateway功能确实,并且在启动的时候控制台会提示缺少webflux和web依赖,会导致功能失效,实际使用时,还是建议通过修改parent依赖来达到目的,将parent依赖中的web和webflux依赖移除

猜你喜欢

转载自blog.csdn.net/Cy_LightBule/article/details/87014037