在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按照名称匹配

 

Logo

一站式虚拟内容创作平台,激发创意,赋能创作,进入R空间,遇见同道,让优质作品闪耀发光。​

更多推荐