运行程序报错,,错误的创建bean

来源:4-1 基于bootstrap开发页面结构

鲨鱼尖椒

2018-07-06 18:17

我service的测试类ok的,也能访问index.jsp,就是访问list.jsp报错,,哪位大神帮忙看一下,,谢谢!


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)}

  


Caused by: 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)}

web.xml

https://img2.mukewang.com/5b4300f700010cf214070717.jpg

spring-web.xml

https://img.mukewang.com/5b4301ca0001784815610781.jpg

写回答 关注

1回答

  • 慕粉3982481
    2018-07-12 17:33:17

    你的SeckillServiceImpl这个类是不是没有加注解,比如:@Service。不加注解的话,BeanFactory就不会知道他是一个Bean,这样,在SeckillController 中使用@Autowired注解注入的时候,Spring容器就会找不到对应的Bean

    鲨鱼尖椒

    加过了,xml配置写错了

    2018-09-12 16:22:13

    共 1 条回复 >

Java高并发秒杀API之web层

Java实现高并发秒杀API的第三门课,介绍Web层的设计和实现

66084 学习 · 395 问题

查看课程

相似问题