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 )的更多相关文章

  1. Spring 自动装配 Bean

    Spring3系列8- Spring 自动装配 Bean 1.      Auto-Wiring ‘no’ 2.      Auto-Wiring ‘byName’ 3.      Auto-Wiri ...

  2. Spring自动装配Bean详解

    1.      Auto-Wiring ‘no’ 2.      Auto-Wiring ‘byName’ 3.      Auto-Wiring ‘byType 4.      Auto-Wirin ...

  3. Spring自动装配歧义性笔记

    Spring自动装配歧义性笔记 如果系统中存在两个都实现了同一接口的类,Spring在进行@Autowired自动装配的时候,会选择哪一个?如下: // 一下两个类均被标记为bean @Compone ...

  4. spring 自动装配 default-autowire=&quot;byName/byType&quot;

    <PRE class=html name="code">spring 自动装配 default-autowire="byName/byType"   ...

  5. Spring自动装配Beans

    在Spring框架,可以用 auto-wiring 功能会自动装配Bean.要启用它,只需要在 <bean>定义“autowire”属性. <bean id="custom ...

  6. Spring自动装配----注解装配----Spring自带的@Autowired注解

    Spring自动装配----注解装配----Spring自带的@Autowired注解 父类 package cn.ychx; public interface Person { public voi ...

  7. Spring系列七:Spring 自动装配

    相思相见知何日?此时此夜难为情. 概述 在Spring框架中,在配置文件中声明bean的依赖关系是一个很好的做法,因为Spring容器能够自动装配协作bean之间的关系.这称为spring自动装配. ...

  8. Spring自动装配之依赖注入(DI)

    依赖注入发生的时间 当Spring IOC 容器完成了Bean 定义资源的定位.载入和解析注册以后,IOC 容器中已经管理类Bean定义的相关数据,但是此时IOC 容器还没有对所管理的Bean 进行依 ...

  9. Spring自动装配(二)

    为什么Spring要支持Autowire(自动装配) 先写几个类,首先定义一个Animal接口表示动物: 1 public interface Animal { 2 3 public void eat ...

随机推荐

  1. Linux命令之type,whatis,whereis,which,locate,find

    第一个:type--查询一个命令的类型 -查询一个命令为内部或者外部命令的命令: -linux的众多命令中,有内部命令和外部命令,这时可以用type命令来查询一个命令到底是属于内部命令还是属于外部命令 ...

  2. Html5学习进阶四 表单元素和表单属性

    HTML5 的新的表单元素: HTML5 拥有若干涉及表单的元素和属性. 本章介绍以下新的表单元素: datalist keygen output 浏览器支持 Input type IE Firefo ...

  3. UVA 10801 Lift Hopping 最短路

    2种方式直接代码就可以了.注意首次不需要60S的转换 #include <map> #include <set> #include <list> #include ...

  4. Linux平台用C++实现事件对象,同步线程

    前文在Win32平台上用C++实现了事件对象Event,对线程进行同步,以达到期望目的.这次在Linux平台上实现与之类似的事件对象.与其相关的一组API包括:pthread_mutex_init,p ...

  5. python 操作数据库1--连接、执行sql语句

    #!/usr/bin/env python # -*- coding:utf-8 -*- # @Time : 2017/11/20 16:03 # @Author : lijunjiang # @Fi ...

  6. 用RegisterHotKey注册系统热键

    函数功能:该函数定义一个系统范围的热键. 函数原型:BOOL RegisterHotKey(HWND hWnd,int id,UINT fsModifiers,UINT vk): 参数: hWnd:接 ...

  7. dbgprint_Mine 调试输出

    void DbgPrintf_Mine(char*pszFormat,...) { #ifdef _DEBUG char szbufFormat[0x1000]; char szBufFormat_G ...

  8. python的递归算法学习(1)

    递归函数在函数内部,可以调用其他函数.如果一个函数在内部调用自身本身,这个函数就是递归函数.举个例子,我们来计算阶乘 n! = 1 * 2 * 3 * ... * n,用函数 fact(n)表示,可以 ...

  9. 【转载】使用 PIVOT 和 UNPIVOT

    可以使用 PIVOT 和 UNPIVOT 关系运算符将表值表达式更改为另一个表.PIVOT 通过将表达式某一列中的唯一值转换为输出中的多个列来旋转表值表达式,并在必要时对最终输出中所需的任何其余列值执 ...

  10. Activator常用方法

    1.获取图片 public static Image getImage(String key) {        Image img = getDefault().getImageRegistry() ...