美文网首页
IDEA编辑器的小脾气(could not autowire)

IDEA编辑器的小脾气(could not autowire)

作者: 我弟是个程序员 | 来源:发表于2017-11-29 15:26 被阅读0次

springboot集成mybatis的时候用到这个:

@Resource
private UserMapper userMapper;

或者这个:

 @Autowired
 private UserMapper userMapper;

如果使用的是 Idea,这块的注解经常会报“could not autowire”,Eclipse 却没有问题,其实代码是正确的,这是 Idea 的误报。

下面一招教你解决误报抛红

单击 File | Settings | Editor | Inspections 命令,使用搜索功能找到Autowiring for Bean Class 选项,将 Severity 的级别由之前的 error 改成 warning 即可。

相关文章

网友评论

      本文标题:IDEA编辑器的小脾气(could not autowire)

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