Overview I’ve been asked several times to explain the difference between injecting Spring beans with ‘@Resource’, ‘@Autowired’, and ‘@Inject’. While I received a few opinions from colleagues and read a couple of posts on this topic I didn’t feel like
目录 问题 解决办法 备注 问题 在项目中,我们使用Spring的@Autowired注解去引入其他类时有时候阿里的编码规约插件就会提示:"Field injection is not recommended"或"Could not autowired. No beans of 'xxx' type found.",引用类的变量名会有红色的波浪线,虽然不影响程序执行,但是强迫症看着还是难受. 解决办法 将"@Autowired"注解换为"
Intellij idea @AutoWired注入bean 出现红色波浪线,@autowird下面显示黄色波浪线或者标黄,如下图,解决方法总结一下供大家使用 首先选择File--Settings--Inspections,然后在右侧搜索 spring Core,如下图所示,去掉,Autowiring for bean class[去掉自动装配依赖对象的红线警告] 和 Field injection warning[去掉黄色背景]后面的√即可. 本文借鉴:https://blog.csdn.n