Spring Boot application integrates DataSource
quickly.
- Import dependencies
<dependency>
<groupId>com.yookue.springstarter</groupId>
<artifactId>datasource-builder-spring-boot-starter</artifactId>
<version>LATEST</version>
</dependency>
By default, this starter will auto take effect, you can turn it off by
spring.datasource-builder.enabled = false
- Configure your beans with a
DataSourceBuilder
bean by constructor or@Autowired
/@Resource
annotation, then you can create beans with it as following:
Method Return | Method Name |
---|---|
DataSourceProperties | dataSourceProperties |
DataSource | dataSource |
DataSource | xaDataSource |
DataSourceTransactionManager | jdbcTransactionManager |
JpaTransactionManager | jpaTransactionManager |
- This starter supports the most popular data source pools in the word, including
- c3p0
- dbcp2
- druid
- hikari
- oracle ucp
- tomcat
- vibur
- 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 Yookue Network Technology Ltd.
- Yookue: https://yookue.com