[org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory]: Factory method ‘redisConnectionFactory’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig

Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource..._apache


出现这个原因是因为lettuce池底层使用了commons-pool2,所以需要导入这个依赖

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>

导入这个依赖即可