使用 @Resource或@Autowire时 Idea报错Could not autowire. No beans of 'xxxService' type found. more..出现红色波浪线

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36802726/article/details/84026031

错误: 

使用注解@Resource或者@Autowire
intellij Idea报错Could not autowire. No beans of 'xxxService' type found. more... (Ctrl+F1)

出现红色波浪线

原因:

目前我遇到两种情况:

1、编译报错时是因为xxxService的ServiceImpl实现类没有加入注解@Service。

2、IntellijIDEA本身工具的问题。

解决方法:

1、在ServiceImpl实现类加入注解@Service

2、降低IDEA的Autowired检测的级别。

在settings - Editor - Inspections - Spring - Spring Core - Code - Autowiring for Bean Class 勾去掉

猜你喜欢

转载自blog.csdn.net/qq_36802726/article/details/84026031
今日推荐