@org.springframework.beans.factory.annotation.Autowired(required=true)
来源:互联网 发布:mac ae插件怎么安装 编辑:程序博客网 时间:2024/05/29 18:10
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'paymentOrderController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.chaoge.service.paymentOrderService com.chaoge.controller.paymentOrderController.pos; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.chaoge.service.paymentOrderService] 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)}
由于自己平常做项目时喜欢喜欢各种尝试,所有特别多奇葩错误!今天遇到了这个问题搞了半天,在网上也看了下别人的错误,和我的有点不一样,突然想到配置springMvc只配置了controller扫描注入,未配置service扫描注入,所以使用@Autowired无法注入报错!分享一下,也给以后留个答案!
在springMvc文件中配置以下代码就可以了:
<!-- 扫描controller,service(controller,service层注入) -->
<context:component-scan base-package="com.chaoge.controller"/>
<context:component-scan base-package="com.chaoge.service"/>
由于自己平常做项目时喜欢喜欢各种尝试,所有特别多奇葩错误!今天遇到了这个问题搞了半天,在网上也看了下别人的错误,和我的有点不一样,突然想到配置springMvc只配置了controller扫描注入,未配置service扫描注入,所以使用@Autowired无法注入报错!分享一下,也给以后留个答案!
在springMvc文件中配置以下代码就可以了:
<!-- 扫描controller,service(controller,service层注入) -->
<context:component-scan base-package="com.chaoge.controller"/>
<context:component-scan base-package="com.chaoge.service"/>
2 4
- @org.springframework.beans.factory.annotation.Autowired(required=true)
- @org.springframework.beans.factory.annotation.Autowired(required=true)
- Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)
- mapper注入失败问题解决 {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- 报错:Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- Spring异常: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
- bug解决_{@org.springframework.beans.factory.annotation.Autowired(required=true)}
- beans.factory.BeanCreationException beans.factory.annotation.Autowired(required=true)
- 异常:org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
- Spring的Annotation使用注意(org.springframework.beans.factory.NoSuchBeanDefinitionException)
- org.springframework.beans.factory.BeanCreationException
- org.springframework.beans.factory.BeanCreationException
- org.springframework.beans.factory.BeanCreationException
- org.springframework.beans.factory.BeanDefinitionStoreException
- org.springframework.beans.factory.BeanCreationException
- org.springframework.beans.factory.BeanDefinitionStoreException:
- org.springframework.beans.factory.BeanCreationException
- (九十)第六章复习题
- 选择排序之直接选择排序
- android 屏幕适配,hdpi,xhdpi,xxhdpi理解,常见出图
- Android:apk反编译步骤,打包、签名和逆向工程经验总结
- C /C++标准库 - <cstdlib>(stdlib.h)
- @org.springframework.beans.factory.annotation.Autowired(required=true)
- zzulioj 1842: LT的求助again and again (简单模拟)
- 理解RESTful架构
- windows下利用svn钩子同步部署目录的方法
- c++primer第五版第十四章练习
- UI第二十三天:动画
- 上拉下拉刷新(1)
- 第16周项目1-验证算法(6)堆排序
- centos 开启防火墙