ShopServiceTest单元测试报错
来源:4-5 店铺注册之Service层的实现
章鱼兽
2018-12-06
严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6df97b55] to prepare test instance [com.zhangyu.o2o.service.ShopServiceTest@6736fa8d]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.zhangyu.o2o.service.ShopServiceTest’: Unsatisfied dependency expressed through field ‘shopService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.zhangyu.o2o.service.ShopService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
Process finished with exit code 255
这是因为什么啊老师
1回答
-
Unsatisfied dependency expressed through field ‘shopService’
同学好,请确保你的Service实现类已经加入了@Service标签,和视频里说的一样
012019-03-13
相似问题