首页 > 其他分享 >MybatisPlus(九) 插件的使用~防全表更新与删除插件(配置类篇)

MybatisPlus(九) 插件的使用~防全表更新与删除插件(配置类篇)

时间:2023-03-12 14:33:13浏览次数:37  
标签:插件 MybatisPlus 删除 addInnerInterceptor 防全表 new interceptor

一、Springboot 配置防全表更新与删除插件

@Configuration
public class MybatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //添加分页插件
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        //添加乐观锁插件
        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        //防全表更新与删除插件
        //针对 update 和 delete 语句 作用: 阻止恶意的全表更新删除
        interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());

        return interceptor;
    }

}

 

 

标签:插件,MybatisPlus,删除,addInnerInterceptor,防全表,new,interceptor
From: https://www.cnblogs.com/Life-QX/p/17208115.html

相关文章