1.起因🤶🤶🤶🤶
redis搭建完成后,准备启动主程序,异常兴奋,结果报错了!!!!
2.究竟是何原因 😭😭😭😭😭
出现一下错误:
- 1.RedisConnectionFactory is required
- 2.Error creating bean with name 'redisTemplate' defined in class path resource [com/xz/config/RedisConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: RedisConnectionFactory is required
- 3.Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'redisTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTemplate
源码一探究竟
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'redisTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTemplate' defined in class path resource [com/xz/config/RedisConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: RedisConnectionFactory is required
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:713) ~[spring-beans-5.3.30.jar:5.3.30]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject

文章讲述了开发者在使用SpringBoot集成Redis时遇到的错误,主要问题是由于RedisConnectionFactory未配置导致的Bean创建失败。通过添加连接工厂并配置序列化,问题得以解决。作者提醒读者注意配置细节,防止粗心引起的错误。
最低0.47元/天 解锁文章
4435

被折叠的 条评论
为什么被折叠?



