enable: true # 設置啟動 eld-sql
dataSource: "custom" # 設置為自定義
sqlite:
file: "central.db"
mysql:
host: 127.0.0.1
port: 3306
database: database
username: username
password: password
useSSL: false
pool:
name: SQL-Pool
minSize: 5
maxSize: 10
connectionTimeout: 30000
idleTimeout: 60000
maxLifeTime: 600000
@Override
public void bindServices(ServiceCollection collection) {
SQLInstallation sqlInstallation = collection.getInstallation(SQLInstallation.class);
DataSource dataSource = ... // 獲取你的數據源
// 請設置與 DataSource 類型一致的 Dialect 類型,這邊以自定義的 MySQL 數據源為例
sqlInstallation.injectDataSource(dataSource, MySQL8Dialect.class);
}