5. 成功解决:Could not autowire. No beans of 'RedisConnectionFactory' type found.

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介: 今天建了一个新项目,使用 Spring Boot 整合 Redis 时,IDEA 被提醒“Could not autowire. No beans of 'RedisConnectionFactory' type found. ”错误,意思是不能自动装配“RedisConnectionFactory”。

image.png

问题描述

今天建了一个新项目,使用 Spring Boot 整合 Redis 时,IDEA 被提醒“Could not autowire. No beans of 'RedisConnectionFactory' type found. ”错误,意思是不能自动装配“RedisConnectionFactory”。

虽然有这个错误提醒,但是可以正常使用,很奇怪。

bfcbb0f64fd3903b1862ddb2a9bd3cfc_image_auth_key=1686703504-5YyZcaQkg1vztL4teiPdw4-0-90c50ba6d283e43f4db279bf01ca6c42&file_size=76598.png

另外我的 Spring Boot 版本是 2.7.3

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.3</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

原因分析

之前的项目一直是这么使用,所以不会是代码的问题。那就只能试下其他的版本。经过排查,确定是 Spring Boot 版本的问题,我试过所有 2.7. 的版本,都会有这个问题。而降到 2.6. 版本,就不会有这个提示。

解决方案

将 Spring Boot 版本降到 2.6.11 版本,即可解决。

4e97519742499a21f69488d315481c80_image_auth_key=1686703517-cd3iY9xFmMdViG2uC2bMZj-0-4d30a16404390a7ed149fba1e9223f5e&file_size=62638.png

2.6.11 是 2.6.* 中最新的 GA 版:

b28a06e80345afff8e4b189a40c6a186_image_auth_key=1686703529-6YGXsCR3F9sy7CJZtS7L33-0-8fe7bb260f411e5604eb54d8e29cb553&file_size=58422.png

目前还不知道2.7.* 版本会出现这个问题,后面知晓后会更新答案。

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
7月前
|
XML C# 数据格式
C#报错 The ‘xmins‘ attribute is not supported in this context
System.Xml.Schema.XmlSchemaException:“The ‘xmins’ attribute is not supported in this context.”异常的解决百度翻译:System.Xml.Schema.XmlSchemaException:“此上下文中不支持”xmins“属性。”这是在使用System.Data.DataSet的ReadXml读取x...
51 0
C#报错 The ‘xmins‘ attribute is not supported in this context
|
10月前
|
Java 数据库连接 mybatis
Consider defining a bean of type ‘com.example.democrud.democurd.usermapper.DaoMapper‘ in your config
Consider defining a bean of type ‘com.example.democrud.democurd.usermapper.DaoMapper‘ in your config
109 0
|
1天前
No qualifying bean of type [com.XX.mapper.SysNameMapper ] found for dependency
No qualifying bean of type [com.XX.mapper.SysNameMapper ] found for dependency
75 0
|
7月前
|
Java 编译器
解决NoSuchBeanDefinitionException: No qualifying bean of type ‘bean.User‘ available
解决NoSuchBeanDefinitionException: No qualifying bean of type ‘bean.User‘ available
|
7月前
|
Java Spring
BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘ defined in class
BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘ defined in class
107 0
|
9月前
|
Java Apache Spring
解决required a single bean, but 2 were found问题
背景:springboot整合shiro中自定义Realm时出现 错误描述 Parameter 0 of method getDefaultWebSecurityManager in cn.ken.springboot_shiro.config.ShiroConfig required a single bean, but 2 were foun
|
10月前
Error creating bean with name ‘userServiceImpl‘: Unsatisfied dependency expressed through field ‘bas
Error creating bean with name ‘userServiceImpl‘: Unsatisfied dependency expressed through field ‘bas
214 0
|
10月前
|
XML Java 程序员
Spring启动报错--class path resource [Beans.xml] cannot be opened because it does not exist
程序员不是在去生产bug的路上,那就是在去解决bug的路上。🤣🤣🤣🤣
90 1
|
11月前
|
Java
springboot3 解决:Could not autowire. No beans of ‘JavaMailSender‘ type found
因为 spring-boot-starter-mail 默认使用某些包发生了变化,在 2.2.xx 版本前后不一,解决对应bug
292 0
|
11月前
|
druid
A bean with that name has already been defined in class path resource and overriding is disabled.
A bean with that name has already been defined in class path resource and overriding is disabled.
155 0