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

org.tinygroup.databasebuinstaller.DataSourceHolder Maven / Gradle / Ivy

There is a newer version: 2.2.3
Show newest version
package org.tinygroup.databasebuinstaller;

import javax.sql.DataSource;

import org.tinygroup.beancontainer.BeanContainerFactory;
import org.tinygroup.database.util.DataSourceInfo;

public class DataSourceHolder {
	
	private static DataSource dataSource;
	
	public static void setDataSource(DataSource dataSource){
		DataSourceHolder.dataSource=dataSource;
	}

	public static DataSource getDataSource() {
		if(dataSource==null){
			dataSource = BeanContainerFactory.getBeanContainer(
					DataSourceHolder.class.getClassLoader()).getBean(
					DataSourceInfo.DATASOURCE_NAME);
		}
		return dataSource;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy