Springboot 集成mybatis-plus过程中遇到的一些问题

在Springboot项目中集成mybatis-plus时,遇到BaseMapper CRUD接口无法使用的问题,原因是未正确配置MybatisPlusConfig。另外,配置文件中的properties注解设置不正确可能导致值始终为null。此外,XML映射文件未被扫描到通常是配置路径不完整导致,需检查yml配置中的包扫描路径。
摘要由CSDN通过智能技术生成

1.要是用mp的BaseMapper的crud接口,必须重写MybatisPlusConfig配置文件,否则扫描不到对应的map接口,报错找不到什么statement(具体错误记不得了),主要的配置代码如下:

//此处好像也必须,否则mp的3.x版本会报错,需要指定DialectType这个玩意
@Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor page = new PaginationInterceptor();
        page.setDialectType("mysql");
        return page;
    }
//尤其是这个方法,必须重写,使用MybatisSqlSessionFactoryBean这个Bean
 @Bean
    public MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean() throws IOException {
        MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean();
        mybatisPlus.setDataSource(dataSource);
        mybatisPlus.setVfs(SpringBootVFS.class);
        if (StringUtils.hasText(this.properties.getConfigLocation())) {
            mybatisPlus.setConfigLocation(this.resourceLoader.getResource(this.properties.getCo
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值