Giter VIP home page Giter VIP logo

Comments (2)

2229499815 avatar 2229499815 commented on July 4, 2024

组件使用了spring的父子容器,理论上这个配置不会影响到你的项目配置,需要你提供更多的报错和调试信息

from async-excel.

SSSDNSY avatar SSSDNSY commented on July 4, 2024

image
根据我的调试信息,正如你这个注释所说,其实ExcelMybatisPlusConfiguration.java的配置已经 生成了 SqlSessionFactory类型的名为“excelSqlSessionFactory”的Bean,但是才看到后面的父子容器加载,而mybatisplus的MybatisPlusAutoConfiguration.java的

...
    @Bean
    @ConditionalOnMissingBean
    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
}
...

mybatisplus的AutoConfiguration配置类有这个注解:@ConditionalOnMissingBean ,@ConditionalOnMissingBean 注解不会让spring再去生成SqlSessionFactory 的bean。 同时,MybatisPlusAutoConfiguration在这个方法里面有这么几句是去globalConfig.setMetaObjectHandler ,这个就是前面我所说的导致了MetaObjectHandler的原因。

  // TODO 注入填充器

        if (this.applicationContext.getBeanNamesForType(MetaObjectHandler.class,
            false, false).length > 0) {
            MetaObjectHandler metaObjectHandler = this.applicationContext.getBean(MetaObjectHandler.class);
            globalConfig.setMetaObjectHandler(metaObjectHandler);
        }

结合调试,综上,其实际使用和调试,延迟加载的子容器并没有很好的隔离开asyncExcel的mybatis.globalConfig, 覆盖了业务侧的配置。
退而求其次,其实可以出一个多数据源的就可以了,业务表和下载的task表都是在一个数据库的,甚至可否不隔离交由业务选择或者配置,而且task表的字段和信息业务可能需要拓展和自己命名字段名等。
可能我因业务开发之余,匆忙之下的调试推理,不够严谨细致,还请大佬指教。

组件使用了spring的父子容器,理论上这个配置不会影响到你的项目配置,需要你提供更多的报错和调试信息

from async-excel.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.