概述
项目在启动的时候会报错:
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name ‘redisUtil’ for bean class [com.sinoccdc.devops.utils.common.RedisUtil] conflicts with existing, non-compatible bean definition of same name and class [com.sinoccdc.devops.utils.tracelog.RedisUtil]
关键点在于这个xx的类,名称重复了
Annotation-specified bean name ‘xx’ for bean class [xxx] conflicts with existing, non-compatible bean definition of same name and class[xxx]
原因:
spring中有相同名称的类时,使用时没有明确指定bean名称,则会抛出异常:
最简单的方法:
在项目中查找重复的Bean名称,将部分重复的bean名称更改一下;更改原则是:公共包下面的Bean保持原名称,自己模块下重复的Bean名称改为新的名称即可
最后
以上就是激情战斗机为你收集整理的ConflictingBeanDefinitionException异常,Annotation-specified bean name ‘redisConfig‘ for bean class的全部内容,希望文章能够帮你解决ConflictingBeanDefinitionException异常,Annotation-specified bean name ‘redisConfig‘ for bean class所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复