public interface DSFactory extends Serializable
DataSource
工厂方法接口,借助不同配置,同一个工厂可以连接多个相同或不同的数据库,但是连接池只能使用一种。createDataSource(ConnectionConfig)
方法完成数据源的创建。关系如下:DSFactory _____________________|____________________ | | | | HikariDSFactory DruidDSFactory XXXDSFactory ... _____|____ | _____|____ | | | | | MySQL SQLite SQLServer XXXDB XXXDB2
Modifier and Type | Method and Description |
---|---|
DataSource |
createDataSource(ConnectionConfig<?> config)
创建数据源
|
String |
getDataSourceName()
获取自定义的数据源名称,用于识别连接池
|
String getDataSourceName()
DataSource createDataSource(ConnectionConfig<?> config)
config
- 数据库配置DataSource
Copyright © 2025. All rights reserved.