当前使用版本(必须填写清楚,否则不予处理)

3.3.1.tmp

该问题是怎么引起的?(最新版上已修复的会直接close掉)

在IDEA里,默认情况下生成的Mapper,在Spirng 中使用时,会由IDEA进行错误提示: Could not autowire. No beans of 'ClientGisInfoMapper' type found. 运行时无影响。这是Mybatis的通病

我常用的解决方案是在生成的Mapper文件中打 org.springframework.stereotype.Repository 注解可以解决这一问题。

是否能在代码生成器中增加一个配置,当启用时,为生成的Mapper文件增加这一注解?

重现步骤

1、生成Mapper文件

2、在IDEA的Spring项目中使用Mapper类

报错信息

Could not autowire. No beans of 'ClientGisInfoMapper' type found.

Comment From: nieqiurong

使用IDEA插件或者自定义模板即可.

Comment From: Planeswalker23

不注入到 Spring, 虽然会有错误提醒,但是程序还是可以正常运行的

Comment From: CodingOX

安装 一个mybatis插件可以解决问题,比如:MyBatisCodeHelperPro

Comment From: sakurawald

安装 一个mybatis插件可以解决问题,比如:MyBatisCodeHelperPro

This works. Install the plugin "MyBatisCodeHelperPro". Don't try to modify the default editor inspection. That's an in-correct solution.