spring注入时报错::No qualifying bean of type 'xxx.xxMapper'

 

做一个小项目,因为有 baseService,所以偷懒就没有写单独的每个xxService接口,直接写的xxServiceImpl,结果在service实现类中注入Mapper的时候,用的 @Autowired,

结果,junit一启动,就报错误:Java.lang.illegalStateException:Failed to load ApplicationContext

具体是在 创建bean的时候报:No qualifying bean of type 'xxx.xxMapper' abailable:expected at least 1 bean which qualifies as autowire candidate.......

错误,

经过百度即测试,发现解决方法是:

在@Autowired 注解下面加上@Qualifier(“xxxxxMapper”)注解

转载于:https://www.cnblogs.com/libin6505/p/8378735.html

你可能感兴趣的:(spring注入时报错::No qualifying bean of type 'xxx.xxMapper')