最近学习redis碰到的坑记录一下。
No qualifying bean of type ‘org.springframework.data.redis.core.RedisTemplate<java.lang.String, java.lang.Object>’ available
Could not autowire. No beans of ‘RedisConnectionFactory’ type found.
SpringBoot版本2.7.12,进行序列化测试,发现RedisConnectionFactory无法自动注入
解决方案:
方案一:
将这个RedisConfig文件移动到xxxApplication启动类同级包或者子包中即可。
方案二:
主启动类添加扫包操作@ComponentScan(“包路径”),也能正常触发序列化,如果包比较多,可以直接指定扫到config包