Could not autowire field: private javax.servlet.http.HttpServletRequest
在写单元测试类的时候,报错,废了很大劲才给调试好,给大家分享下。

完整错误如下:
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的更多相关文章
- Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.******.seashell.bpc.query.query.service.FscBankPayCodeQueryService
2019-03-19 16:22:14,945 WARN [main] (org.springframework.context.support.AbstractApplicationContext. ...
- Java-API:javax.servlet.http.HttpServletRequest
ylbtech-Java-API:javax.servlet.http.HttpServletRequest 1.返回顶部 1. javax.servlet.http Interface HttpSe ...
- Java-Class-I:javax.servlet.http.HttpServletRequest
ylbtech-Java-Class-I:javax.servlet.http.HttpServletRequest 1.返回顶部 2.返回顶部 1. package com.ylbtech.ap ...
- java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z 的解决
jetty 9 嵌入式开发时,启动正常,但是页面一浏览就报错如下: java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest ...
- 无法解析类型 javax.servlet.http.HttpServletRequest。从必需的 .class 文件间接引用
java.lang.Error: 无法解析的编译问题: 无法解析类型 javax.servlet.http.HttpServletRequest.从必需的 .class 文件间接引用了它 无法解析类型 ...
- The import javax.servlet.http.HttpServletRequest cannot be resolved
Error: The import javax.servlet cannot be resolved The import javax.servlet.http.HttpServletRequest ...
- 在Myeclipse buildpath 加server lib (server runtime)/项目导入时报错:The import javax.servlet.http.HttpServletRequest cannot be resolved
来源于:http://blog.csdn.net/dingqinghu/article/details/8805922 http://yl-fighting.iteye.com/blog/140946 ...
- The type javax.servlet.http.HttpServletRequest cannot be resolved.
The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from ...
- javax.servlet.http.HttpServletRequest;
错误提示是没有引入javax.servlet.http.HttpServletRequest所在的包,编译错误. 这么添加: 项目-->右键-->properties-->java ...
随机推荐
- python 爬虫2 Urllib库的高级用法
1.设置Headers 有些网站不会同意程序直接用上面的方式进行访问,如果识别有问题,那么站点根本不会响应,所以为了完全模拟浏览器的工作,我们需要设置一些Headers 的属性. import url ...
- JavaScript入门:004—JS凝视的写法和基本运算符
JS的凝视JS中加凝视和寻常写C#代码是几乎相同的.有//和/* */这两种.单行凝视使用双斜杠比如. <script type="text/javascript"> ...
- 跟上Java8 - 日期和时间实用技巧,转自知乎王爵nice
作者:王爵nice链接:https://zhuanlan.zhihu.com/p/28133858来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 当你开始使用Java操 ...
- vue高级路由
1.html <script src="https://unpkg.com/vue/dist/vue.js"></script><script src ...
- Cocos2d-x Lua中多场景切换生命周期
在多个场景切换时候,场景的生命周期会更加复杂.这一节我们介绍一下场景切换生命周期.多个场景切换时候分为几种情况:情况1,使用pushScene函数从实现GameScene场景进入SettingScen ...
- 使用IDEA工具整合mybatis时使用@Resource和@Autowired自动注解bean时会显示红色问题的解决办法
使用IDEA工具整合mybatis时使用@Resource和@Autowired自动注解bean时会显示红色问题的解决办法 idea中springboot整合mybatis时,通过@Autowired ...
- 安装IntelliJ IDEA 破解安装
IDEA 功能介绍 1-深度智力 IntelliJ IDEA为您的源代码编制索引后,通过在每个环境中提供相关建议,提供快速,智能的体验:即时和智能的代码完成,即时代码分析和可靠的重构工具. 2-开箱即 ...
- Python 新手常犯错误
Python 新手常犯错误(第二部分) 转发自:http://blog.jobbole.com/43826/ 作用域 在这篇文章里,我们来关注作用域在Python被误用的地方.通常,当我们定义了一个全 ...
- python函数回顾:all()
描述 all() 函数用于判断给定的可迭代参数 iterable 中的所有元素,是否不为 0.''.False 或者 iterable 为空,如果是返回 True,否则返回 False. 如果是空元组 ...
- HDU 4193 Non-negative Partial Sums(单调队列)
题目大意: 给定一个长度为n的循环序列.从n个不同位置開始,问有几个位置使得一下情况成立:全部前缀的和都大等于0(n <=1000000). 下午的训练赛.之前没学过单调队列所以用的线段树 ...