yulichang / mybatis-plus-join

支持连表查询的mybatis-plus,mybatis-plus风格的连表操作提供wrapper.leftJoin(),wrapper.rightJoin()等操作
https://yulichang.github.io/mybatis-plus-join-doc/
Apache License 2.0
1.01k stars 115 forks source link

业务上无法再使用 SqlInjector #51

Closed dong4j closed 1 year ago

dong4j commented 1 year ago

因为 MybatisPlusJoinAutoConfiguration.mpjSqlInjector 和 MybatisPlusJoinAutoConfiguration.mpjSqlInjectorOnMiss 会创建 ISqlInjector 的实例, 然而如果业务代码也需要创建 ISqlInjector 的时间, 就会导致存在多个 bean:

Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.baomidou.mybatisplus.core.injector.ISqlInjector' available: expected single matching bean but found 2: mpjSqlInjectorOnMiss,sqlInjector