01: IntelliJ Idea解决Could not autowire. No beans of ‘xxxx’ type found

1)在注解上加上:

@Autowired(required = false)

1

(2)使用 @Resource 替换 @Autowired

(3)在 MyBatis 接口上加上 @Repository 注解

(4)使用 Lombok,@RequireArgsContructor

(5)降低 Autowired 检测的级别,将 Severity 的级别由之前的 error 改成 warning 或其它可以忽略的级别。


(6)安装 MyBatis 插件

(7)构造器注入

我的解决方式;

在启动类上加上

@MapperScan("com.xuecheng.manage_course")


原文链接:https://blog.csdn.net/qq_40147863/article/details/86103857

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容