SpringBoot中提示required a single bean, but 2 were found

两种解决办法:
一.
1.把其一个bean加上@Primary注解

2.在注入的属性添加@Qualifier注解

二. 

Springboot启动类添加了的扫描注解@xxxSan,需要配置好扫描范围,否则就会出现重复扫描。

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://www.net2asp.com/874a4d4040.html