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

当前使用版本3.1.1,该版本在生产环境中已使用至少半年时间,由于mybatis低版本存在漏洞,需升级到3.5.6版,所以将mybatis-plus升级到了3.4.1版

该问题是如何引起的?(确定最新版也有问题再提!!!)

目前发现 com.baomidou.mybatisplus.extension.service.impl.saveOrUpdate 方法存在使用上的疑问,会报出 because can not find cache of TableInfo for entity! 的错误。经过版本切换发现。该方法是在mybatis-plus 3.4.0版本时进行修改的,3.4.0以下均无问题。

关键代码 TableInfo tableInfo = TableInfoHelper.getTableInfo(xxx);

重现步骤(如果有就写完整)

...... SirmSetting sirmSetting = sirmSettingService.getOne(new QueryWrapper().eq("MODULE", request.getModule()).eq("NAME", request.getName())); sirmSetting.setValue(request.getValue()); sirmSettingService.saveOrUpdate(sirmSetting); ......

报错信息

because can not find cache of TableInfo for entity!

Comment From: nieqiurong

看下service推断的entityClass是不是你当前这个,最好提供一个小型复现工程上来.

Comment From: 84330299

感谢您的建议,已做过实验。对比代码发现,是在自定义的ServiceImpl类添加了@Configuration注解导致entityClass为Object类型,未能获取到真正的类名,奇怪的是3.1.1版本该注解不收影响。但3.4.0版本就出现异常。

Comment From: bosen365

也发现这个问题了

Comment From: 84330299

也发现这个问题了

我是在业务实现类上添加了@configuration注解导致的,不过之前的版本是可以的,可能更严格了?