@autowired注解失败

来源:4-2 Spring Bean装配之Autowired注解说明-1

努力学习有糖吃

2017-07-08 20:35

http://img.mukewang.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回答

  • 努力学习有糖吃
    2017-07-08 20:47:34

    已解决。。。

    nize19... 回复慕仔4276...

    @Autowired 下面调用的类,调用到了之前写的同名包了,不是xml配置里面的路径里面的包

    2017-08-31 19:59:40

    共 2 条回复 >

Spring入门篇

为您带来IOC和AOP的基本概念及用法,为后续高级课程学习打下基础

268787 学习 · 963 问题

查看课程

相似问题