All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jchanghong.database.DSHolder.kt Maven / Gradle / Ivy

There is a newer version: 2.3.0.8.1
Show newest version
package jchanghong.database

import cn.hutool.db.DbUtil
import org.springframework.boot.jdbc.DataSourceBuilder
import javax.sql.DataSource

/**
 * @author : jiangchanghong
 * @version : 2019-08-26 11:18
 */
object DSHolder {
    private val map: HashMap = hashMapOf()
    fun get(url: String, user: String, pass: String): DataSource {
        map[url]?.let { return it }
        val dataSource = DataSourceBuilder.create()
            .url(url).username(user).password(pass).build()
        map[url] = dataSource
        return dataSource
    }


    val check_db by lazy {  DbUtil.getDs("check_db")!!}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy