Spring @bean冲突解决方案
发布日期:2021-06-30 19:00:21 浏览次数:2 分类:技术文章

本文共 642 字,大约阅读时间需要 2 分钟。

引用2个jar都实现了相同的@bean注入,这个是feign的Level

@Beanpublic Level feignLoggerLevel() {        return Level.FULL;}

这样报错:

escription:xxx required a single bean, but 2 were found:        - feignLoggerLevel: defined by method 'feignLoggerLevel' in class path resource [com/xxx.class]        - logger: defined by method 'logger' in class path resource [com/yyy.class]Action:Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

解决办法:

@Bean    @ConditionalOnMissingBean(Logger.Level.class)    public Level feignLoggerLevel() {        return Level.FULL;}

 

转载地址:https://linuxstyle.blog.csdn.net/article/details/114756122 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:不写容易出错的代码
下一篇:编程容易犯的错

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2024年04月17日 12时51分59秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

SOTA model 2019-04-30
GPT (OpenAI GPT) 2019-04-30
Camera-ready ddl 2019-04-30
Knowledge Amalgamation 知识合并 2019-04-30
autossh 2019-04-30
CUB-200鸟类数据集 2019-04-30
MMLab工具箱 —— Runner类 2019-04-30
动态语言 vs. 静态语言 2019-04-30
Python反射机制 2019-04-30
YAPF —— Python代码格式化工具 2019-04-30
MMOCR——config文件 2019-04-30
NCCL 2019-04-30
pip install git+ 2019-04-30
UGC 用户产生内容 2019-04-30
ranger 2019-04-30
slurm 2019-04-30
xfce4 2019-04-30
xrdp 2019-04-30
Raft算法 2019-04-30
Python计算文本BLEU分数 2019-04-30