问题详情:
关键提示
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
两种爬坑方法
————————————————————————————————————————————
上坑之一:
在application.yml或application.properties文件中
spring.main.allow-bean-definition-overriding = true
介绍:
与另一个名称相同(稍后处理)的Bean会覆盖较旧的Bean,但尚不清楚以后将处理哪个。
引用文章:
https://juejin.cn/post/6994259421740138510
————————————————————————————————————————————
[推荐] 上坑之二:
给每个serviceImpl类添加
@Primary
tips:适用于无重复名bean的service层
介绍:
在声明bean的时候,通过将其中一个可选的bean设置为首选
引用文章:
https://www.jianshu.com/p/a42f3c835b20
————————————————————————————————————————————