Spring Boot application integrates mybatis
quickly, to support several mybatis bean instances, typically with multiple DataSource
.
- Import dependencies
<dependency>
<groupId>com.yookue.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
MybatisConfigurationDelegator
bean by constructor or@Autowired
/@Resource
annotation, then you can create beans with it as following:
Method Return | Method Name |
---|---|
SqlSessionFactory | sqlSessionFactory |
SqlSessionTemplate | sqlSessionTemplate |
- Github: https://github.com/yookue/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 Yookue to support the development.
- Yookue: https://yookue.com