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 ...
随机推荐
- Split Divisibilities (Project Euler 598)
题目大意: 求将$100!$ 拆成$a*b$的方案数,其中$a<=b$并且它们的约数个数一样多. 思路: 先将$100!$质因数分解, 结果如图: 首先想到一个暴力DP, dp[i][j][k] ...
- Java类载入器原理分析
一:Java虚拟机中能够安装多个类载入器,系统默认是三个基本的类载入器: Bootstrap ExtClassLoader AppClassLoader 类载入器也是Java类.由于其它Java类 ...
- chrome远程调试按inspect后出现的界面为空白,应如何解决?
使用chrome进行远程调试命令: chrome://inspect 编辑hosts文件,添加: Hosts文件路径:C:\Windows\System32\drivers\etc\hosts 61. ...
- 自定制serilazry字段
在获取序列化返回值时候想要有时候我们需要生成我们需要的关联字段 class CourseSerializers(ModelSerializer): # 对于外键,one to one , choice ...
- Charles常用设置
一.软件说明 Charles 通过将自己设置成系统的网络访问代理服务器,使得所有的网络访问请求都通过它来完成,从而实现了网络封包的截取和分析. 二.mock数据 场景说明: 使用步骤: 1.保存待测试 ...
- Android之使用Android-query框架进行开发
开发Android使用Android-query框架能够快速的,比传统开发android所要编写的代码要少得很多,容易阅读等优势. 下载文档及其例子和包的地址:http://code.google.c ...
- Kotlin——初级篇(四):控制语句详解
在前面 的章节中讲解了Kotlin语言中的数据类型.变量与常量的定义.不了解请参见前面的内容: Kotlin--初级篇(三):数据类型详解. Kotlin--初级篇(二)常量.变量.注释. 下面详细为 ...
- 《从零开始学Swift》学习笔记(Day 38)——构造函数与存储属性初始化
原创文章,欢迎转载.转载请注明:关东升的博客 构造函数的主要作用是初始化实例,其中包括:初始化存储属性和其它的初始化.在Rectangle类或结构体中,如果在构造函数中初始化存储属性width和hei ...
- 任务05—学习 MARKDOWN 语言
我的简历地址: https://github.com/jinxiaohang/MyResume/blob/master/ForJavaJob.md 本任务主要目的掌握markdown. 1.首先是工具 ...
- Linux查找命令find、locate、whereis、which、type
find:查找指定下目录的文件 -empty:查找空文件 -name:按名字查找 -type f(文件 or d:目录):按类型查找