Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[错误报告]: java.lang.NoSuchMethodException: com.github.yulichang.autoconfigure.MybatisPlusJoinAutoConfiguration.<init>() #246

Open
3 tasks done
RaymondCJY opened this issue Jan 21, 2025 · 0 comments

Comments

@RaymondCJY
Copy link

确认

  • 我的版本是最新版本, 我的版本号与 version 相同, 并且项目里无依赖冲突
  • 我已经在 issue 中搜索过, 确认问题没有被提出过
  • 我已经修改标题, 将标题中的 描述 替换为遇到的问题

当前程序版本

plus-3.5.10.1, join1.5.2, springboot2

问题描述

项目mybatis升级 mybatis-plus + mybatis plus join
原mybatis是进行手动配置

// 生成 sqlSession
private void registerSqlSessionFactory(String name, DataSource dataSource) {

        BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(MybatisSqlSessionFactoryBean.class.getName());
        builder.addPropertyValue("dataSource", dataSource);
        builder.setInitMethodName("getObject");
        builder.addPropertyValue("typeAliasesPackage", properties.getMybatisTypeAliasesPackage());
        builder.addPropertyValue("typeHandlersPackage", properties.getMybatisTypeHandlersPackage());

        GlobalConfig globalConfig = new GlobalConfig();
        globalConfig.setSqlInjector(new MPJSqlInjector());
        builder.addPropertyValue("globalConfig", globalConfig);

        // TODO:
        VFS.addImplClass(SpringResourceVFS.class);

        builder.addPropertyValue("plugins", createInterceptors());
        builder.addPropertyValue("mapperLocations", scanMapperResources());

        DatabaseIdProvider databaseIdProvider = createDatabaseIdProvider();
        builder.addPropertyValue("databaseIdProvider", databaseIdProvider);
        SmartContext.con.register(name, builder.getRawBeanDefinition());
    }

// 注入自定义插件
private Interceptor[] createInterceptors() {
        List<Interceptor> interceptors = SmartContext.con.getBeans(Interceptor.class);
        int useDefinedSize = interceptors.size();
        Interceptor[] interceptorArr = new Interceptor[useDefinedSize + 3];

        if (interceptors.size() > 0) {
            // user defined interceptors
            System.arraycopy(interceptors.toArray(new Interceptor[]{}), 0, interceptorArr, 0, useDefinedSize);
        }

        SQLExecuteLogInterceptor logInterceptor =
                new SQLExecuteLogInterceptor(properties.isMybatisLoggingEnable(), properties.getMybatisLoggingThreshold());

        MybatisPlusInterceptor pagingInterceptor = new MybatisPlusInterceptor();
        pagingInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));

        interceptorArr[useDefinedSize] = logInterceptor;
        interceptorArr[useDefinedSize+1] = pagingInterceptor;
        interceptorArr[useDefinedSize+2] = new MPJInterceptor();

        return interceptorArr;
    }
  • mybatis-plus 可以正常启动并使用
  • 再集成 join 就会启动失败

详细堆栈日志

Caused by: java.lang.NoSuchMethodException: com.github.yulichang.autoconfigure.MybatisPlusJoinAutoConfiguration.<init>()
.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant