验证添加店铺功能出错

来源:4-5 店铺注册之Service层的实现

慕UI1372024

2020-05-03

图片描述
图片描述
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘shopServiceTest’: Unsatisfied dependency expressed through field ‘shopService’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.imooc.o2o.service.ShopService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
五月 03, 2020 8:43:51 下午 org.springframework.test.context.TestContextManager prepareTestInstance
严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@3a03464] to prepare test instance [com.imooc.o2o.service.ShopServiceTest@409c54f]
java.lang.IllegalStateException: Failed to load ApplicationContext

写回答

1回答

翔仔

2020-05-04

同学好,这里说的是No qualifying bean of type ‘com.imooc.o2o.service.ShopService’ available:

看看你的ShopServiceImpl实现类有没有添加@Service标签,并且BaseTest.java有没有引入sping-service.xml这个配置文件

1
3
慕UI1372024
回复
翔仔
好的我在检查一遍
2020-05-04
共3条回复

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

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

5113 学习 · 8144 问题

查看课程