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

错误详细信息:

1
2
3
4
5
6
7
8
9
10
11
12
***************************
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依赖如下:

1
2
3
4
5
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.11.4</version>
</dependency>

错误原因分析

这是因为redisson里有spring-boot-starter-web导致的。因为我的springcloud-gateway也有这个依赖,依赖冲突导致启动报错。

解决办法

排除依赖即可,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<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时启动报错

文章目录
  1. 错误背景
  2. 错误原因分析
  3. 解决办法