Spring Boot application integrates mybatis quickly, to support several mybatis bean instances, typically with multiple DataSource.
- Import dependencies
<dependency>
<groupId>cn.unikue.springstarter</groupId>
<artifactId>mybatis-delegator-spring-boot-starter</artifactId>
<version>LATEST</version>
</dependency>By default, this starter will auto take effect, you can turn it off by
spring.mybatis-delegator.enabled = false
- Configure your beans with a
MybatisConfigurationDelegatorbean by constructor or@Autowired/@Resourceannotation, then you can create beans with it as following:
| Method Return | Method Name |
|---|---|
| SqlSessionFactory | sqlSessionFactory |
| SqlSessionTemplate | sqlSessionTemplate |
- Github: https://github.com/unikueltd/mybatis-delegator-spring-boot-starter
- Mybatis homepage: https://mybatis.org/mybatis-3
- Mybatis github: https://github.com/mybatis/mybatis-3
- jdk 17+
This project is under the Apache License 2.0
See the NOTICE.txt file for required notices and attributions.
You like this package? Then donate to us to support the development.
Beijing Unikue Network Technology Ltd.
- Unikue: https://unikue.cn