问答详情
源自:4-1 基于bootstrap开发页面结构

总是显示serviceimpl的seckilldao属性无法注入

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seckillServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.seckill.dao.SeckillDao org.seckill.service.impl.SeckillServiceImpl.seckillDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.seckill.dao.SeckillDao] 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)}

提问者:qq_纵横_11 2019-03-15 11:13

个回答

  • 慕工程1333434
    2019-05-20 15:22:04

    NoSuchBeanDefinitionException: No qualifying bean of type [org.seckill.dao.SeckillDao] found for dependency

    容器中没有这个bean,需要在dao加上@Repository

  • jisu_che
    2019-03-16 14:19:39

    我猜你是在seckillServiceImpl上加了@Autowired注解,如果是这样,你将seckillServiceImpl改为seckillService就可以了