Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration.


錯誤詳細信息:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 1 of constructor in com.alibaba.cloud.sentinel.gateway.scg.SentinelSCGAutoConfiguration 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.

錯誤背景

集成redisson出現這個錯誤

redisson的maven依賴如下:

<dependency>
   <groupId>org.redisson</groupId>
   <artifactId>redisson-spring-boot-starter</artifactId>
   <version>3.11.4</version>
</dependency>

錯誤原因分析

這是因為redisson里有spring-boot-starter-web導致的。因為我的springcloud-gateway也有這個依賴,依賴沖突導致啟動報錯。

解決辦法

排除依賴即可,如下:

<dependency>
      <groupId>org.redisson</groupId>
      <artifactId>redisson-spring-boot-starter</artifactId>
      <version>3.11.4</version>
      <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>

參考解決辦法:
springboot集成springCloud中gateway時啟動報錯


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM