今天在做项目的时候 遇到了如下错误
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of resource dependencies failed;
这句话的意思就是原因:org.springframework.beans.factory。BeanCreationException:创建名为“userServiceImpl”的bean时出错:注入资源依赖项失败;
首先我检查了userServiceImpl上添加了@Serive注解 也加入了@Resource
然后我是在UserServiceTest写测试方法的 也注入了@SpringBootTest 和
@Resource private UserService userService;
然而问题仍然没有解决 百思不得其解 折腾了半个小时 才恍然大悟
扫描二维码关注公众号,回复:
15183372 查看本文章
没有加Mapper注解
在启动类上添加mapper注解 问题就解决了