springboot整合redis后出现:Unsatisfieddependencyexp。。。异常:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisController':
Unsatisfied dependency expressed through field 'redisTemplate';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'redisTemplate' defined in class path resource
[org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'redisTemplate' parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'redisConnectionFactory' defined in class path resource
[org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.tion.lettuce.LettuceConnectionFactory]:
Factory method 'redisConnectionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig
解决⽅案:
因为springboot2.x以后⽤得是lettuce,添加连接池依赖
<!-- lettuce pool -->
<dependency>
<groupId>org.apachemons</groupId>
springframework依赖<artifactId>commons-pool2</artifactId>
</dependency>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论