springboot - SqlSessionFactoryBean falls in circular dependencies by Spring Boot's DataSourceInitializer

时间:2023-01-12 07:50:25

springboot mybatis配置多数据源的时候,报错:There is a circular dependency between 7 beans in the application context: xxx

经查,这是mybatis-spring的bug,延迟加载问题:https://github.com/mybatis/spring/issues/58

问题复现的版本组合是:

spring-boot-starter-parent 1.4.1.RELEASE

mybatis 3.2.8

mybatis-spring 1.3.0

问题解决:

mybatis-spring 降到 1.2.2