Annotation-specified bean name conflicts with existing

问题说明

Annotation-specified bean name conflicts with existing,non-compatible bean definition of same name and class

翻译一下,大概就是:

使用的注解发现了2个同名的bean导致了冲突。

原因分析

我用的springboot依赖了2个第三方jar,里面分别有一个AuditConfig bean,我又不能去修改他们,因为不是我维护的。问题清楚了下面解决吧!

问题解决

既然不能去改变第三方依赖,那就尝试在我应用启动的时候排除掉那个不用的bean即可,例如我的做法:

@ComponentScan(basePackages = {"com.xx.xx.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {AuditConfig.class}))

posted @   一锤子技术员  阅读(269)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示