1.问题

解决 No qualifying bean of type 问题

2.思路:

1 检查是否添加了对应注解

2 检查配置是否正确,扫描包名, 类名及id是否正确

一 . 传统SSM项目

ssm项目,出现“No qualifying bean of type found for dependency ***”错误,最后定位到该bean,仔细检查,

1 首先检查是否在类上添加了对应的注解,如:@Controller @Service @Reporsitry @Component

2 然后检查配置文件,发现有没有扫描到相应的包,在配置文件中加上该包

<context:component-scan base-package=

<context:component-scan base-package="com.ayh.order" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>

再如:在applicationContext-Service.xml中,有没有配置所注入service

applicationContext-Service.xml:

 <bean id="orderServiceImp" class="com.it.service.imp.OrderServiceImp"></bean>

3 是否有jar包依赖冲突

如:jpaj的jar包冲突

二 . spring boot项目

@Autowired - No qualifying bean of type found for dependency

1 . 主要就是检查是否在对应的类上添加了注解如:@Controller @Service @Reporsitry @Component

我的是在ReturnCycleReportJobHandler这里没有加入:@Component

2 . 启动类所在的位置是否在其他被扫描类的包的前面

如:启动类要在order包.其他类在下一级包

以下为根据具体选用情况而定, 多用优先级的顺序问题

1 .是否使用在具体mapper上有到 @Mapper

2 . 是否使用在application文件中

mybatis:
type-aliases-package: com.ayh.order.pojo
mapper-locations: com.ayh.order.mappers

3 .是否使用在启动类上用到了@MapperScan(value="com.ayh.order.mappers")

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@MapperScan(value = "com.ayh.order.mappers")
public class OrderApplication {

原文:https://blog.csdn.net/u010565545/article/details/100066824

遇到过的问题之“解决 No qualifying bean of type 问题”的更多相关文章

  1. 解决:No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency

    错误: Description: Field jdbcTemplate in com.gwd.dao.impl.IUserDaoImpl required a bean of type 'org.sp ...

  2. 解决 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type的问题

    具体错误如下: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying be ...

  3. 解决spring-test中Feign问题: No qualifying bean of type 'org.springframework.cloud.openfeign.FeignContext' available

    问题现象: 启动测试类(含通过Feign远程调用的组件),报错: No qualifying bean of type 'org.springframework.cloud.openfeign.Fei ...

  4. No qualifying bean of type [com.shyy.web.service.TreeMapper] found for dependency

    异常信息: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.sp ...

  5. springmvc注入类 NoUniqueBeanDefinitionException: No qualifying bean of type [] is defined: expected single错误

    在springmvc中注入服务时用@Service 当有两个实现类时都标明@Service后则会出现异常: nested exception is org.springframework.beans. ...

  6. spring异步执行报异常No qualifying bean of type 'org.springframework.core.task.TaskExecutor' available

    最近观察项目运行日志的时候突然发现了一个异常, [2018-04-03 10:49:07] 100.0.1.246 http-nio-8080-exec-9 DEBUG org.springframe ...

  7. Caused by:org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type "" available: expected at least 1 bean which qualifies as autowire candidate

    项目使用spring, mybatis.因为分了多个模块,所以会这个模块引用了其它模块的现在,结果使用Junit测试的时候发现有两个模块不能自动注入dao和service问题.解决后在此记录一下. 解 ...

  8. MyBatis Plus:No qualifying bean of type 'com.baomidou.mybatisplus.mapper.BaseMapper<?>' available: expected single matching bean but found 4

    场景: 应用MyBatis Plus 和通用Mapper 继承自ServiceImpl实现对Service里的方法进行包装再处理. public interface IServiceBase2< ...

  9. spring注入时报错::No qualifying bean of type 'xxx.xxMapper'

    做一个小项目,因为有 baseService,所以偷懒就没有写单独的每个xxService接口,直接写的xxServiceImpl,结果在service实现类中注入Mapper的时候,用的 @Auto ...

随机推荐

  1. HDFS的优缺点

    HDFS是一个分布式文件存储系统,前身来自于Google发布的大数据三驾马车之一GFS (Google File System). HDFS的优点: 1.高容错 hdfs具有很高的容错性,数据自动保存 ...

  2. 怎么安装ExpressionTreeVisualizer for Visual Studio 2019

    1.下载  ExpressionTreeVisualizer   https://github.com/zspitz/ExpressionTreeVisualizer/releases    ,  解 ...

  3. 知识增广的预训练语言模型K-BERT:将知识图谱作为训练语料

    原创作者 | 杨健 论文标题: K-BERT: Enabling Language Representation with Knowledge Graph 收录会议: AAAI 论文链接: https ...

  4. JavaWeb后端

    JavaWeb后端 我们学习JavaWeb的最终目的是为了搭建一个网站,并且让用户能访问我们的网站并在我们的网站上做一些事情. 计算机网络基础 在计算机网络(谢希仁 第七版 第264页)中,是这样描述 ...

  5. 用RecyclerView实现列表视图

    RecyclerView能够灵活实现大数据集的展示,视图的复用管理比ListView更好,能够显示列表.网格.瀑布流等形式,且不同的ViewHolder能够实现item多元化的功能.但是使用起来会稍微 ...

  6. 面向对象编程(C++篇2)——构造

    目录 1. 引述 2. 详述 2.1. 数据类型初始化 2.2. 类初始化 1. 引述 在C++中,学习类的第一课往往就是构造函数.根据构造函数的定义,构造函数式是用于初始化类对象的数据成员的.无论何 ...

  7. JZ-056-删除链表中重复的结点

    删除链表中重复的结点 题目描述 在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针. 例如,链表1->2->3->3->4-> ...

  8. Semantic Text Similarity

    stop word是指像the,is ,are等等方向的词 stemming意思就是将形式化为一样的形式,比如lists,listed,list都可以化为list形式.

  9. 商品模型:SPU、商品、SKU概念模型设计

    商品系统是电商SaaS.新零售SaaS最基础.最核心的系统之一.商品系统几乎需要支撑所有业务系统,商品详情.购物车.订单.履约.结算.售后.库存.供应链等,都需要依赖商品系统的能力.为了保障业务的稳定 ...

  10. 在Windows 10 上安装使用binwalk

    Windows 10 推出的WSL 功能可以协助我们直接使用binwalk 分析Windows 内的文件 文章更新时间:2020年3月11日 一.WSL 准备 1.打开控制面板→程序和功能→启动或关闭 ...