springboot测试时启动,报UnsatisfiedDependencyException
来源:4-1 买家类目-dao(上)
慕后端0344139
2019-08-01
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.imooc.service.impl.ProductCategoryServiceImplTest’: Unsatisfied dependency expressed through field ‘categoryService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.imooc.service.impl.ProductCategoryServiceImpl’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.imooc.service.impl.ProductCategoryServiceImpl’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
![
2回答
-
慕容8211654
2019-08-20
我也出现了这个问题,把sell包下的启动类移出去,放在com.imooc下就可以了。我也是创建项目就这样,可能是idea版本不一样导致的吧
00 -
廖师兄
2019-08-01
不要按自己想法乱写。。。课程里没有教@SpringTest()里面这样写吧
022019-08-05
相似问题