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回答

翔仔

2018-12-06

Unsatisfied dependency expressed through field ‘shopService’

同学好,请确保你的Service实现类已经加入了@Service标签,和视频里说的一样

0
1
章鱼兽
非常感谢!
2019-03-13
共1条回复

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程