SSM框架---容器创建注入对象失败异常之个人原因分析小记
来源:互联网 发布:淘宝订机票 编辑:程序博客网 时间:2024/05/01 02:00
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'bsxrServiceImpl': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field:
private com.bj.dao.BsxrDao com.bj.service.BsxrServiceImpl.dao; nested
exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [com.bj.dao.BsxrDao] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for this dependency.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'bsxrDao' defined in file [D:\workspace\.metadata\.plugins\org.eclipse.wst.server.
core\tmp0\wtpwebapps\port_1\WEB-INF\classes\com\bj\dao\BsxrDao.class]: Invocation
of init method failed; nested exception 。。。。。。。。
这个异常网上有很多说法,各种原因,都没有解决。
Error creating bean with name
'bsxrServiceImpl' 注解我是使用的@Autowired ,出现上述异常,困惑了将近一天;
@Autowired 后面加上 (required = false); 不再报 上述异常,但是有新异常
expected com.bj.dao.BsxrDao, but found com.bj.dao,看来是BeanCreationException: Error creating bean with name
'bsxrServiceImpl': 这个异常把expected com.bj.dao.BsxrDao, but found com.bj.dao异常给掩盖掉了。
@Autowired(required = false)会使expected com.bj.dao.BsxrDao, but found com.bj.dao,看来是BeanCreationException: Error creating bean with name
'bsxrServiceImpl': 异常不再显示,所以才发现根本原因,并不是spring的配置文件以及注解的错误。
这个异常就简单了,检查发现使用的mapper的动态代理,但是namespace应该写全限定性接口名,自己写错了,,更改后终于解决问题。
总结一句话:
BeanCreationException: Error creating bean with name
'bsxrServiceImpl': 原因之一就是 mapper动态代理 mapper.xml namespace属性写错了。
第一次写博客,语言组织不周,只想分享一个解决办法,望大家见谅。
感谢http://darkmasky.iteye.com/blog/1129828 博主给我的启发,非常感谢。
- SSM框架---容器创建注入对象失败异常之个人原因分析小记
- @Resource注入失败原因
- spring 之脱离容器管理创建的对象进行依赖注入
- SSM框架之spring学习1——创建对象,处理依赖关系
- struts同时使用属性注入和模型驱动注入数据注入失败原因分析及解决方法
- SSM框架整合异常
- SSH框架之Spring的IOC容器的创建对象、对象依赖关系(1)
- Spring注入失败的原因
- Spring 依赖注入失败原因
- 反射注入失败的原因!
- Spring注入失败的原因
- spring依赖注入失败原因
- SSM框架集个人总结
- 淘淘商城SSM框架之异常处理篇
- springMVC 注入对象失败
- CreateProcess 创建explorer.exe失败的原因简单分析
- ssm框架下的poi导入小记
- 项目失败原因分析
- 自己的学习笔记 - SQL
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- 文件访问控制权限
- leetcode submission/20161012(sum of two integers)
- FPGA 驱动舵机
- SSM框架---容器创建注入对象失败异常之个人原因分析小记
- wmsys.wm_concat
- 【题】【数学(欧拉函数)】NKOJ3801 分解质因数
- Price
- 操作系统进程调度算法图解(FCFS、轮转、SPN、SRT、HRRN、反馈)
- HDU 5829 16多校08 Rikka with Subset (NTT)
- 洛谷 P1080 国王游戏
- 方法
- S5PV210启动过程详解