2022年1月版IntelliJ Idea报错Could not autowire. No beans of ‘xxxx‘ type found的错误

1.问题

首先我拉取代码后,代码文件中报了一个错误,
错误截图;
在这里插入图片描述

2解决思路

idea能正常运行与启动,但在提交代码时会有麻烦,
因此我在其他博客中寻找解决方案:

在这里插入图片描述
但我在idea中没有找到此内容 Autowiring for Bean Class

在这里插入图片描述

按照博客内容我没有找到

我考虑是否是新版idea的问题

因此照着之前的博客进行推断,将博客中修改前与修改后进行翻译,逐个找到翻译类似的将它的错误改成警告,结果成功
在这里插入图片描述
希望其他的小伙伴可以避免跳坑。

3.解决步骤

以下为新的解决步骤:
1.打开idea的 File --> settings -->点击Editor --> Code Style --> inspections

2.输入Autowiring
在这里插入图片描述
3.找到 incorrect injection point autowiring in Spring bean compoments

4.将Error 改成Warnging

5.点击Apply

6.点击Ok,等待几秒钟或者重启就没问题了

在这里插入图片描述

  • 16
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
IDEA中,当使用@Autowired注解时,可能会出现"Could not autowire. No beans of 'resourceDao' type found."这个错误提示。该错误提示的意思是找不到匹配类型为'resourceDao'的bean。这个错误提示一般不会影响程序的编译和运行,但对于一些程序员来说,红色的错误提示可能会有些不舒服。 该错误的原因可能有两个方面。第一个可能是Intellij IDEA本身工具的问题,第二个可能是导入@Service包时导入了错误的包。 解决这个问题的方法有两种。针对第一个可能的原因,可以降低@Autowired检测的级别,将Severity的级别由之前的error改成warning或其他可以忽略的级别。 针对第二个可能的原因,解决方案是确保正确导入了@Service注解所在的包。正确的包应该是import org.springframework.stereotype.Service;而不是import com.alibaba.dubbo.config.annotation.Service;。 希望以上解答对您有所帮助,如果还有任何问题,请随时提问。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [@Autowired报错Could not autowire. No beans of ‘XXX‘ type found](https://blog.csdn.net/weixin_45260582/article/details/129252271)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Idea 解决 Could not autowire. No beans of 'xxxx' type found 的错误提示](https://download.csdn.net/download/weixin_38632624/12751965)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的错误提示](https://blog.csdn.net/u012453843/article/details/54906905)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值