验证添加店铺功能出错
来源: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这个配置文件
132020-05-04
相似问题