测试用户模块注入失败,用浏览器插件调试500 Internal Server Error
来源:6-9 用户模块所有功能自测试
不换行
2018-02-11
tomcat成功启动,但报错,而且用浏览器插件调试出现500 内部服务器错误。。看起来是注入错误,检查了下,serviceimpl有注入
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.shop.service.iUserService com.shop.controller.UserController.IUserService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IUserService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.shop.dao.UserMapper com.shop.service.impl.IUserServiceImpl.usermapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.shop.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IUserService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.shop.dao.UserMapper com.shop.service.impl.IUserServiceImpl.usermapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.shop.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.shop.dao.UserMapper com.shop.service.impl.IUserServiceImpl.usermapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.shop.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.shop.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
3回答
-
ranice
2018-04-21
同学 这个问题解决了吗 我也遇到了这个问题
012018-04-25 -
Geely
2018-02-13
No qualifying bean of type [com.shop.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
同时按照这个异常信息,检查一下,是否spring注入配置的有问题,提示说至少要有一个这个spring对象哟。
usermapper。看看 mybatis的配置scan是否可以扫描到。
【新加入的同学,以为内容请务必仔细阅读,给同学们整理的学习课程的集锦宝典,帮助大家更高效的完成一期课程】 部署环境的话 ,建议看下文章最后一小段哟~首先跟着课程阿里云部署那个章节过一遍,可以先不跟着操作,做到心里有数,环境部署都做了什么。 http://coding.imooc.com/lesson/96.html#mid=3861 课程项目思维导图及线上环境、测试环境、部署linux和windows等解答 http://www.imooc.com/article/20193 尽快进入咱们QQ群哟~~进群方法下面思维导图那个帖子有。非常详细 课程项目思维导图及线上环境、测试环境、部署linux和windows等解答 http://www.imooc.com/article/20193 【重点】问答区常见问题整理 http://www.imooc.com/article/18998 课程项目QQ群分享手记 http://www.imooc.com/article/19094 找工作的季节之简历及找工作的分享 http://www.imooc.com/article/19998 项目环境、vsftpd、linux、mysql等各种配置、软件下载 http://learning.happymmall.com mybatis-plugin插件安装 http://coding.imooc.com/learn/questiondetail/36007.html 【二期进阶Tomcat集群和Redis分布式课程已经上线】 http://coding.imooc.com/class/162.html 【同学,如果学完感觉自己有提高,有收获,Geely恳请同学帮忙给咱们课程10分好评呀,非常非常感谢!同学的支持也是我最大的动力!】
00 -
星辰Iron
2018-02-11
你好同学,报错提示
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.shop.dao.UserMapper] found for dependency
排查一下看看com.shop.dao.UserMapper里面的内容是否和老师的代码一致。
00
相似问题