IDEA 的自动编译配置与使用Mybatis时注入报错问题

开启实时编译

打开IDEA到Preferences搜索Compiler,再购选上Build project automatically,之前在下边就多了个Problems窗口,它可以帮助我们及时发现错误

使用Mybatis时注入报错问题

在使用@Autowired注解注入一个类时,因为用的Mybatis,默认IDEA会报错并提示找不到bean,但项目能正常运行,因为用的Spring-AutoScan自动扫描的方法
解决:在Preferences搜索inspections,找到Spring -> Spring Core -> Code -> Autowiring for Bean Class 将它原本的Errors修改为Warning (目前新版IDEA找不到这个)

posted @ 2021-09-20 18:15  Jerome27  阅读(180)  评论(0编辑  收藏  举报