首页 > 编程语言 > 详细

Could not autowire field: private javax.servlet.http.HttpServletRequest

时间:2017-12-07 20:23:18      阅读:309      评论:0      收藏:0      [点我收藏+]

在写单元测试类的时候,报错,废了很大劲才给调试好,给大家分享下。

技术分享图片

 

完整错误如下:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘buskjjlzjwyhpsController‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.servlet.http.HttpServletRequest com.yunhwa.business.controller.buskjjlzjwyhpsController.request; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.servlet.http.HttpServletRequest] 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)}

 最后加入该注解完美解决

技术分享图片

 

Could not autowire field: private javax.servlet.http.HttpServletRequest

原文:http://www.cnblogs.com/summary-2017/p/8000626.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!