场景

SpringBoot项目在启动时提示:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or us

因为sringboot通过@Autowired注入接口的实现类时发现有多个,也就是有多个类继承了这个接口,spring容器不知道使用哪一个。

加@Primary表示某个实现类首选注入

更多推荐

SpringBoot中提示:Consider marking one of the beans as @Primary, updating the consum