场景:
多个Module相互依赖,其中的服务模块调用dao模块,出现下面报错。
报错信息如下:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loanApplyController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loanApplyServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'ccx.coop.mapper.LoanApplyInfoMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
提取关键词:beans.factory.BeanCreationException
出现改异常无非俩个原因:
1、引入资源没有注入到bean工厂;
2、引入资源是否有重名嫌疑。
我的解决方法是:在服务模块启动类增加mapper的接口实现:
@MapperScan("ccx.coop.mapper")
本文深入探讨了在Spring框架中,当多个Module相互依赖时,出现的BeanCreationException异常原因及解决方案。主要聚焦于资源未注入bean工厂及资源重名问题,并提供了解决方法:在服务模块启动类中增加@MapperScan注解。
5307

被折叠的 条评论
为什么被折叠?



