org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.xingxue.service.SeckillService com.xingxue.test.serviceImpl.SeckillServiceImplTest.seckillService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.xingxue.service.SeckillService] 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)}
类似这种错误,
首先,看下所有的配置文件是否正确。
第二:习惯性的包命名习惯: com.xx.service
com.xx.service.impl
有关扫描service包的配置:
这种配置是正确的,但是有一个隐蔽的错误 就是service的实现类的包名写成: com.xx.serviceImpl
那么无论如何,spring也无法扫描到你的service实现类,那么项目就会报错