could not autowire. No beans of 'ItemService' type found

Checks autowiringproblems in beans class.

前言:

技术的积累和钻研虽说是永无止境的,但是对于我们每一个独立的 个体来说,不断的进步, 与时俱进,才是最重要的, 让自己终生学习,持续的进步, 能时刻适应社会的进步.

一,问题:

某天调试中,突然发现,不能引用了, @Autowired不起作用了?

could not autowire. No beans of 'ItemService' type found Checks autowiringproblems in beans class.

二,详情:

这是怎么回事?

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.taotao.service.ItemService] 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)}at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1308)at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:530)

错误: org.springframework.beans.factory.BeanCreationException:Could not autowire field

通过小编发分析, 已经对网上经验的搜集,就是没有对相关的包扫描到罢了.

解决方案:

缺少包的扫描, 很简单, 只需要将包的扫描添加上就可以了.

<context:component-scan base-package="com.taotao.service,com.taotao.mapper,com.taotao.controller,com.taotao.pojo,com.taotao.serviceimpl"/>

最后问题解决!

三,小结:

遇到问题,那是时常的事情,尤其是越长大,随着自己认知的提升,接触的事务越多,遇到的事情也会越多,遇到的 bug 也会越多的. 在项目中亦是如此,解决问题多了,见的多了,可能未来会遇到的 bug 越多,但是成长过程中,让人提升很多的见识,bug 见多了,后面会达到一种境界的.

could not autowire. No beans of 'ItemService' type found Checks autowiringproblems in beans class.相关推荐

  1. SpringBoot报错:Could not autowire. No beans of ‘DiscussantMapper‘ type found

    SpringBoot报错:Could not autowire. No beans of 'DiscussantMapper' type found 一.资源 @Mapper和@Repository注 ...

  2. idea中Could not autowire. No beans of 'xxxxMapper' type found.问题解决

    idea中Could not autowire. No beans of 'xxxxMapper' type found.问题解决 解决方案: 建议给Mapper增加@Repository注解,并加入 ...

  3. Could not autowire. No beans of 'JavaMailSender' type found..md

    Could not autowire. No beans of 'JavaMailSender' type found. 导入依赖 <dependency><groupId>o ...

  4. 【ActiveMQ】消息生产者自动注入报错:Could not autowire. No beans of 'JmsMessagingTemplate' type found

    标签:public   style   hat   and   报错   require   core   ota   ati 使用ActiveMQ过程中,定义消息生产者: package com.s ...

  5. Could not autowire. No beans of ‘xxxMapper‘ type found.

    在使用IDEA编写代码过程中,你可能会遇到这种情况: Could not autowire. No beans of 'xxxMapper' type found. 一般情况下,这种错误是不影响正常编 ...

  6. IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示

    2019独角兽企业重金招聘Python工程师标准>>> 1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xx ...

  7. IDEA 报 「Could not autowire. No beans of ‘UserMapper‘ type found」错误解决方案

    IDEA 报 「Could not autowire. No beans of 'UserMapper' type found」错误解决方案 参考文章: (1)IDEA 报 「Could not au ...

  8. IDEACould not autowire. No beans of 'xxxMapper' type found.

    作为一名刚开始使用idea的新手,最近在使用maven+springMVC框架时遇到了这样一个问题:Could not autowire. No beans of 'xxxMapper' type f ...

  9. Could not autowire. No beans of 'StudentService' type found

    Controller层 错误提示:Could not autowire. No beans of 'StudentService' type found 原因一:可能是你的Spring.xml配置文件 ...

最新文章

  1. 猫=图灵机?4项测试证明,「猫猫计算机」可执行任意计算
  2. 计算机意外地重新启动或遇到错误。windows安装无法继续。若要安装windows 请单击 确定 重新启动计算机...
  3. 【星球知识卡片】图像风格化与翻译都有哪些核心技术,如何对其长期深入学习...
  4. 杭州 |《PMCAFF产品经理第一课》阿里国际CRM、LinkedIn、丁香园、网易邮箱等一线大咖私房干货免费奉送!...
  5. css在线留言星号,使用CSS 给表单必选项添加星号的实现方法
  6. 关于Integer.MAX_VALUE + 1 = Integer.MIN_VALUE 问题
  7. NSString和SwiftString的区别和使用场景
  8. 漂亮的带分步说明的 VBA 自制进度条
  9. torchvision resize 指定生成图片的尺寸
  10. 看过各地的方言标语,才明白什么叫文字的力量
  11. 收到手机第二天就自燃?S10机主怒告三星 要求道歉并索赔1元
  12. 6、Cocos2dx 3.0游戏开发找小三之游戏的基本概念
  13. To C、To G、To B,数字化转型
  14. 第十六周项目3电子词典
  15. 嵌入式--串口、RS232、RS485通信
  16. rails 调试工具pry 换掉debugger 和 rails c
  17. 每日一狗 · 比利牛斯山犬
  18. 关于弹出和隐藏输入法
  19. 解决排列组合问题的通用算法
  20. CSS的表格样式和列表样式

热门文章

  1. 【图像识别】基于二维条形码识别matlab 源码含GUI
  2. ajax文件夹,的jQuery/AJAX上传图像并保存到文件夹
  3. Adam 优化算法详解
  4. 小程序Mpx框架入门
  5. 如何把pdf转换成jpg pdf转换成jpg只需四步
  6. 喜马拉雅听 手机端协议分析
  7. 什么情况需要数据归一化处理?
  8. Exit and Status
  9. python 常用的8种经典数据结构
  10. Mysql的默认密码