spring自动装配(No qualifying bean )
No qualifying bean of type [com.wfj.service.cms.main.ChannelMng] 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)}
1、检查注解引入的包是否正确,一般为(org.springframework.stereotype.*){service,controller,responsity,repository}
2、扫描包没扫描上(配置文件base-package配置出现异常)
eg:
<mvc:annotation-driven />//扫描组件
<context:component-scan base-package="com.sun.test.aircraft.controller" use-default-filters="false"><!-- base-package 如果多个,用“,”分隔 -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
扫描com.sun.test.aircraft.controller包下的注解(base-package配置的是最终的包路径,该包下使用的@Service,@Autowired,@Controller 等注解都会扫描到)
这种写法对于include-filter来讲它都会扫描,而不是仅仅扫描@Controller 此文章观点可能有误,若理解有偏差,请参考其他博主文章(此文章是我当时做案例时以配置bean的方式脑子里想的注解的方式做的测试,后来发现出错了并不是我想的那样, 所以此文章暂时不做参考)
spring自动装配(No qualifying bean )的更多相关文章
- Spring 自动装配 Bean
Spring3系列8- Spring 自动装配 Bean 1. Auto-Wiring ‘no’ 2. Auto-Wiring ‘byName’ 3. Auto-Wiri ...
- Spring自动装配Bean详解
1. Auto-Wiring ‘no’ 2. Auto-Wiring ‘byName’ 3. Auto-Wiring ‘byType 4. Auto-Wirin ...
- Spring自动装配歧义性笔记
Spring自动装配歧义性笔记 如果系统中存在两个都实现了同一接口的类,Spring在进行@Autowired自动装配的时候,会选择哪一个?如下: // 一下两个类均被标记为bean @Compone ...
- spring 自动装配 default-autowire="byName/byType"
<PRE class=html name="code">spring 自动装配 default-autowire="byName/byType" ...
- Spring自动装配Beans
在Spring框架,可以用 auto-wiring 功能会自动装配Bean.要启用它,只需要在 <bean>定义“autowire”属性. <bean id="custom ...
- Spring自动装配----注解装配----Spring自带的@Autowired注解
Spring自动装配----注解装配----Spring自带的@Autowired注解 父类 package cn.ychx; public interface Person { public voi ...
- Spring系列七:Spring 自动装配
相思相见知何日?此时此夜难为情. 概述 在Spring框架中,在配置文件中声明bean的依赖关系是一个很好的做法,因为Spring容器能够自动装配协作bean之间的关系.这称为spring自动装配. ...
- Spring自动装配之依赖注入(DI)
依赖注入发生的时间 当Spring IOC 容器完成了Bean 定义资源的定位.载入和解析注册以后,IOC 容器中已经管理类Bean定义的相关数据,但是此时IOC 容器还没有对所管理的Bean 进行依 ...
- Spring自动装配(二)
为什么Spring要支持Autowire(自动装配) 先写几个类,首先定义一个Animal接口表示动物: 1 public interface Animal { 2 3 public void eat ...
随机推荐
- JS省份联级下拉框
<script type="text/javascript"> var china=new Object();china['北京市']=new Array('北京市区' ...
- error MSB3073 解决方法(转)
原文转自 http://blog.csdn.net/yangjie569889321/article/details/28488151 最近将VC2002 代码移植到VC2010,出现编译错误:1&g ...
- 用 gdb 调试 GCC 程序【转】
用 GDB 调试程序 原著:Rick McMullin 用 gdb 调试 GCC 程序 转自:http://blog.csdn.net/bonnshore/article/details/795542 ...
- DropZone图片上传控件的使用
前台代码: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w ...
- centos6.5 以 zero-dependency Erlang from RabbitMQ 搭建环境
rabbitmq 官方安装文档可参考:http://www.rabbitmq.com/install-rpm.html ,由于rabbitmq 使用Erlang 开发的,运行环境需要用到Erlang ...
- 【数据库】E-R模型
E-R模型 实体:客观存在并可相互区别的事物称为实体.可以是具体的人.事.物或抽象的概念. 属性:实体所具有的某一特性称为属性.一个实体可以由若干个属性来刻画. 联系:现实世界中事物内部以及事物之间的 ...
- 第二部分:Spring中配置mongodb
一.需要引用的jar包 1.spring-data-mongodb-1.9.4.RELEASE.jar 2.spring-data-commons-1.12.11.RELEASE.jar 3.mong ...
- NetStream配置
http://support.huawei.com/enterprise/docinforeader!loadDocument1.action?contentId=DOC1000067951& ...
- 51nod 1090 3个数和为0【二分】
1090 3个数和为0 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 给出一个长度为N的无序数组,数组中的元素为整数,有正有负包括0,并互不相等.从 ...
- Controlled Tournament(状态压缩DP)
Controlled Tournament 题意 n 名选手进行淘汰赛,R[i][j] = 1 表示 i 能胜过 j.要求通过安排淘汰赛使得,m 选手获得最终胜利,问使得比赛数最少的方案数. 分析 设 ...