MyBatisPlus 报MP_OPTLOCK_VERSION_ORIGINAL not found. Available parameters are错误
配置mybatisplus乐观锁的过程
1、在数据库表中添加version字段类型int
2、在实体类中增加version属性,属性上增加@Version注解
3、配置乐观锁插件

@Configuration public class MyBatisConfig { //乐观锁插件 @Bean public MybatisPlusInterceptor mybatisPlusInterceptor(){ MybatisPlusInterceptor interceptor =new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); return interceptor; } }
提示Parameter 'MP_OPTLOCK_VERSION_ORIGINAL' not found. Available parameters are [param1, et]是因为mybatisplus版本的原因, 新的版本这样配置相当于没有生效,老本的是OptimisticLockerInterceptor已经过时了
参考:https://baomidou.com/pages/0d93c0/#_1-%E9%85%8D%E7%BD%AE%E6%8F%92%E4%BB%B6
posted on 2023-01-04 15:55 lovezj9012 阅读(666) 评论(0) 收藏 举报