在写单元测试类的时候,报错,废了很大劲才给调试好,给大家分享下。
完整错误如下:
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)}
最后加入该注解完美解决
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/15455.html