在spring中出现:
org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'cn.mesmile.test.dao.IUserDao' available: expected single matching bean but found 2: user2DaoImpl,userDaoImpl
分析原因:
在dao层:
在service层:
解决方案:
@AutoWired是按照类型匹配,所以有多个实现的时候,会产生混淆。配合@Qualifier按照名称匹配