Could not autowire field: private javax.servlet.http.HttpServletRequest详解编程语言

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

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: [email protected](required=true)}

 最后加入该注解完美解决

Could not autowire field: private javax.servlet.http.HttpServletRequest详解编程语言

 

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/15455.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论