为了账号安全,请及时绑定邮箱和手机立即绑定

@autowired注解失败

http://img1.sycdn.imooc.com//5960d1270001ac6707840308.jpg

为什么提示注解失败

代码如下:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testComponent': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.testBean.InjectionDAO com.testBean.TestComponent.injectionDAO; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.testBean.InjectionDAO] 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)}

正在回答

1 回答

已解决。。。

0 回复 有任何疑惑可以回复我~
#1

慕仔4276564

什么原因?
2017-07-19 回复 有任何疑惑可以回复我~
#2

nize1989 回复 慕仔4276564

@Autowired 下面调用的类,调用到了之前写的同名包了,不是xml配置里面的路径里面的包
2017-08-31 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

@autowired注解失败

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号