在SpringBoot整合MybatisPlus的乐观锁版本问题的时候,会碰到的报错。
SpringBoot 2.5.7 +MybatisPlus 3.4.1
应该是3.4.1版本把原来的方法过时处理了,导致在容器找不到Bean。
改为下面就可以正常使用:
@Bean public MybatisPlusInterceptor optimisticLockerInnerInterceptor(){ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); return interceptor; }