A bean with that name has already been defined in class path resource and overriding is disabled.

问题出现在我在配置druid 的时候,我配置完之后,因为druid @Primary表示这里定义的DataSource将覆盖其他来源的DataSource。

但是报错了
A bean with that name has already been defined in class path resource and overriding is disabled.
很显然它说不能重写,还告诉我们可以重命名一个bean,或者通过设置spirng.main来进行覆盖.spring.main.allow-bean-definition-overriding=true

然后我们配置进去就行了
A bean with that name has already been defined in class path resource and overriding is disabled.