美文网首页
IDEA | 解决 Could not autowire. No

IDEA | 解决 Could not autowire. No

作者: Ada54 | 来源:发表于2020-05-11 09:30 被阅读0次

    问题:

    在idea进行开发中,使用 @Autowired 时遇到提示Could not autowire. No beans of 'xxxx' type found.,但是程序运行正常。

    问题原因1:

     Intellij IDEA 本身工具的问题。

    解决方法:

    方法一,在注解上添加:@Autowired(required = false)

    方法二,降低idea的Autowired检测级别

    打开idea的配置,在Editor >> Inspections>> Spring >> Spring Core >> Code >>Autowiring for Bean Class 把Serverity级别由Error改编为Warning >> Apply >> OK

    相关文章

      网友评论

          本文标题:IDEA | 解决 Could not autowire. No

          本文链接:https://www.haomeiwen.com/subject/tvpaihtx.html