IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的错误提示
本文转自:http://blog.csdn.net/u012453843/article/details/54906905
1.问题描述
在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示。但程序的编译和运行都是没有问题的,这个错误提示并不会产生影响。但红色的错误提示在有些有强迫症的程序员眼里,多多少少有些不太舒服。

2. 原因
第一种原因,spring auto scan配置,在编辑情况下,无法找到对应的bean,于是提示找不到对应bean的错误。常见于mybatis的mapper,如下:
<!-- mapper scanner configurer -->
<bean id="mapperScannerConfig" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.adu.spring_test.mybatis.dao" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>
3. 解决方案
针对第一种原因,解决办法是:降低Autowired检测的级别,将Severity的级别由之前的error改成warning或其它可以忽略的级别。

针对第二种原因,解决方案当然是导入正确的包。首先我们来看下最容易导入的错误包,如下所示:
importcom.alibaba.dubbo.config.annotation.Service;
正确的包应该是下面这个
importorg.springframework.stereotype.Service;
切记切记啊!!!!
IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的错误提示的更多相关文章
- IntelliJ Idea 解决 Could not autowire. No beans of 'xxxx' type found 的错误提示
IntelliJ Idea 解决 Could not autowire. No beans of 'xxxx' type found 的错误提示哈,在使用 @Autowired 时,今天又遇一坑,这俩 ...
- IntelliJ Idea如何解决Could not autowire. No beans of 'xxxx' type found的错误提示
问题描述 在idea中进行开发时,经常会遇见Could not autowire. No beans of 'xxxx' type found的错误提示,这样的是不影响程序编译和运行的,但是看起来会很 ...
- IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的, ...
- 【转】IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的, ...
- Could not autowire. No beans of 'xxxx' type found的错误
在Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示.但程序的编译和运行都是没有问题的,这个错误提示并 ...
- IntelliJ Idea设置Could not autowire. No beans of 'xxx' type found
1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of ‘xxxx’ type found的错误提示.但程序的编译和运行都是没有问题的, ...
- 解决 "Could not autowire. No beans of 'SationMapper' type found" 的问题
网上查找的方法,附上原文链接:https://blog.csdn.net/Coder_Knight/article/details/83999139 方法1:在mapper文件上加@Repositor ...
- SpringBoot学习- 7、问题Could not autowire. No beans of 'xxxx' type found处理
SpringBoot学习足迹 这个问题网上有好多同学都提到这个问题,代码可以运行,但是就是有红线,强迫症不能忍 自己试验下 1.增加一个final编译一下,再删掉就不会出红线了 public clas ...
- Could not autowire. No beans of 'TbItemMapper' type found. less... (Ctrl+F1) Checks autowiring prob
Intellij Idea开发工具在@Autowired或者@Resource注入XxxMapper接口时报如下错误: Could not autowire. No beans of 'TbItemM ...
随机推荐
- dwz 刷新当前navtab
List.jsp 其navtabId为TradingStrategy_31: <form method="post" action="${contextPath}/ ...
- DWZ学习记录--关闭loading效果
修改文件:jquery-1.7.1.js 查找内容:7142行 ajaxSettings: { 修改内容:global: true=>global: false修改目的:关闭loading效果
- MyBatis使用Collection查询多对多或一对多结果集bug
情况描述:当使用JOIN查询,如果SQL查询出来的记录不是按id列排序的,则生成的List结果会有问题 案例: 1) 数据库模型 简而言之一个Goods包含多个Goods_Img 2) Java Be ...
- 【BZOJ】【2242】【SDOI2011】计算器
快速幂/扩展欧几里得/BSGS 经典好例题!! 三个问题三种算法…… 算法:白书(算法竞赛入门经典——训练指南)全有…… /************************************** ...
- 【BZOJ】【2595】【WC2008】游览计划
Orz zky神犇http://blog.csdn.net/iamzky/article/details/42029921 spfa的灵活应用!(好像是求了一个叫做斯坦纳树的东西……) o(︶︿︶)o ...
- 第八章 ArrayBlockingQueue源码解析
注意:在阅读本文之前或在阅读的过程中,需要用到ReentrantLock,内容见<第五章 ReentrantLock源码解析1--获得非公平锁与公平锁lock()><第六章 Reen ...
- 第七章 常用Java集合类总结
7.1.List(允许重复元素) ArrayList: 底层数据结构:Object[] 在查询(get).遍历(iterator).修改(set)使用的比较多的情况下,用ArrayList 可扩容,容 ...
- 细聊MySQL的分区功能
此篇主要介绍下MySQL的分区功能.我们分别从分区的概念.分区对于MySQL应用的优点.分区的类别及设置来和大家一起探讨下MySQL的分区. 什么是分区? MySQL在未启用分区功能时,数据库的单个表 ...
- MongoDB学习笔记(四)--索引 && 性能优化
索引 基础索引 ...
- Win10系统下面的TR1008解决方案
最近为了体验高大上的Win10系统,于是就把本本原来的Win7旗舰版 升级 到了Win10专业版.之后又在本本上部署了cognos,但是在打开Transform导入IQD数据源的时候就报错了,错误和之 ...