The bean ‘xxxxx‘, defined in class path resource [XXXXXXX]依赖定义冲突异常

本质上就是导入的依赖中出现了重名,ioc进行注入的时候会根据名字来,这样的话就会遭成依赖冲突,我的错误是
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'connectionManager' defined in class path resource [org/springframework/cloud/openfeign/clientconfig/HttpClientFeignConfiguration.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.openfeign.clientconfig.HttpClientFeignConfiguration; factoryMethodName=connectionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/openfeign/clientconfig/HttpClientFeignConfiguration.class]] for bean 'connectionManager': There is already [Generic bean: class [com.github.tobato.fastdfs.domain.conn.ConnectionManager]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in URL [jar:file:/D:/Apps/Learn/Maven3.8.8/apache-maven-3.8.8/repository/com/github/tobato/fastdfs-client/1.26.5/fastdfs-client-1.26.5

这个错误信息表明在Spring容器中存在名为connectionManager的bean定义冲突。具体来说,错误信息中提到了在HttpClientFeignConfiguration类中定义了名为connectionManager的bean,而在其他位置(fastdfs-client-1.26.5.jar中)也存在相同名称的connectionManager的bean。

解决方法:

配置文件添加

YAML 复制代码
#yaml 这里演示格式
spring: 
   main:
    allow-bean-definition-overriding: true
相关推荐
蓝天下的守望者9 小时前
验证环境中使用队列的pop_front()思维惯性引发的bug
bug
一只小菜鸡..13 小时前
南京大学 操作系统 (JYY) 学习笔记:并发 Bug 的地狱——数据竞争、死锁与原子性违反
笔记·学习·bug
名字还没想好☜1 天前
React 受控输入框光标跳到末尾:格式化输入时的 selection 丢失 bug 与修复
前端·javascript·react.js·bug·react·next.js
陈 洪 伟2 天前
大模型推理引擎vLLM(30):由一个GLM5 bug,整理MLP中的SwiGLU、算子融合、量化相关问题
bug·mlp·vllm
endeavor123 天前
BUG(记录)
bug
不断学习加努力5 天前
使用rviz2进行可视化时,cpu资源占用过高的bug
bug
happyness445 天前
如何利用 AI 自动编写单元测试(Unit Test)来捕捉隐藏的边缘情况 Bug?
人工智能·单元测试·bug
深念Y5 天前
Windows幽灵端口占用:HNS如何无声偷走你的端口
windows·python·bug·环境·端口·特权
AI多Agent协作实战派9 天前
AI多Agent协作系统实战(二十二):从6列到12列——任务监控报告的进化之路
java·人工智能·uni-app·bug
自然 醒9 天前
记录We码开发者工具的一个bug
前端·javascript·bug