運(yùn)行程序報(bào)錯,,錯誤的創(chuàng)建bean
我service的測試類ok的,也能訪問index.jsp,就是訪問list.jsp報(bào)錯,,哪位大神幫忙看一下,,謝謝!
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
spring-web.xml
2018-07-12
你的SeckillServiceImpl這個類是不是沒有加注解,比如:@Service。不加注解的話,BeanFactory就不會知道他是一個Bean,這樣,在SeckillController 中使用@Autowired注解注入的時候,Spring容器就會找不到對應(yīng)的Bean