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

3.4.1

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

配置了自定义的sqlSessionFactory

public class MybatisPlusConfig { @Autowired private Environment env;

@Autowired
private DataSource dataSource;

@Autowired
private MybatisPlusProperties properties;

@Autowired(required = false)
private Interceptor[] interceptors;

@Autowired(required = false)
private DatabaseIdProvider databaseIdProvider;

@Autowired
private ResourceLoader resourceLoader = new DefaultResourceLoader();

/**
 * 分页插件 旧版
 */
// @Bean
// public PaginationInterceptor paginationInterceptor()
// {
// return new PaginationInterceptor();
// }

/**
 * 乐观锁插件
 *
 * @return
 */
// @Bean
// public OptimisticLockerInterceptor optimisticLockerInterceptor() {
// return new OptimisticLockerInterceptor();
// }

/**
 * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题
 */
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    // 乐观锁插件
    interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
    // 分页插件
    interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
    return interceptor;
}

@Bean
public ConfigurationCustomizer configurationCustomizer() {
    return configuration -> configuration.setUseDeprecatedExecutor(false);
}

/**
 * 这里全部使用mybatis-autoconfigure 已经自动加载的资源。不手动指定 配置文件和mybatis-boot的配置文件同步
 *
 * @return
 */
@Bean(name = "sqlSessionFactory")
public MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean() {
    log.info("初始化SqlSessionFactory");
    log.info("dynamicDataSource:{}", dataSource);
    log.info("mybatisPlus Properties:{}", this.properties);
    MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean();
    mybatisPlus.setDataSource(dataSource);
    mybatisPlus.setVfs(SpringBootVFS.class);
    if (StringUtils.hasText(this.properties.getConfigLocation())) {
        mybatisPlus.setConfigLocation(this.resourceLoader.getResource(this.properties.getConfigLocation()));
    }
    mybatisPlus.setConfiguration((MybatisConfiguration)properties.getConfiguration());
    if (!ObjectUtils.isEmpty(this.interceptors)) {
        mybatisPlus.setPlugins(this.interceptors);
    }
    mybatisPlus.setPlugins(new Interceptor[] { // PerformanceInterceptor(),OptimisticLockerInterceptor()
        mybatisPlusInterceptor() // 添加分页功能
    });
    MybatisConfiguration mc = new MybatisConfiguration();
    mc.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class);
    mybatisPlus.setConfiguration(mc);
    if (this.databaseIdProvider != null) {
        mybatisPlus.setDatabaseIdProvider(this.databaseIdProvider);
    }
    if (StringUtils.hasLength(this.properties.getTypeAliasesPackage())) {
        mybatisPlus.setTypeAliasesPackage(this.properties.getTypeAliasesPackage());
    }
    if (StringUtils.hasLength(this.properties.getTypeHandlersPackage())) {
        mybatisPlus.setTypeHandlersPackage(this.properties.getTypeHandlersPackage());
    }
    if (!ObjectUtils.isEmpty(this.properties.resolveMapperLocations())) {
        mybatisPlus.setMapperLocations(this.properties.resolveMapperLocations());
    }
    return mybatisPlus;
}

}

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

报错信息

启动时出现

_ _ | _ |. ___ _ | _ | | |\/|)(| | |\ |)|||\ / |
3.4.1 _ _ |
_ |. ___ _ | _ | | |\/|)(| | |\ |)|||\ / |
3.4.1 这个信息出现2次,同一个项目,另一个模块启动正常,分页正常,出现2次的这个模块分页出现2次 limit ,分页插件只注册了一次

Comment From: miemieYaho

自行排查