package cn.stylefeng.team.meta.db.util;

import cn.stylefeng.team.meta.db.pojo.DatabaseConfig;
import com.alibaba.druid.pool.DruidDataSource;

public class DataSourceUtil {

    public static DruidDataSource getDruidDataSource(DatabaseConfig databaseConfig) {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl(databaseConfig.getJdbcUrl());
        dataSource.setDriverClassName(databaseConfig.getDriverClass());
        dataSource.setUsername(databaseConfig.getUsername());
        dataSource.setPassword(databaseConfig.getPassword());
        dataSource.setTestWhileIdle(false);
        dataSource.setFailFast(true);
        return dataSource;
    }

}
