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

cicada.mybatis.config.DBConfig Maven / Gradle / Ivy

The newest version!
package cicada.mybatis.config;


// @EnableTransactionManagement
//@Configuration
//@PropertySource(value = { "classpath:conf/jdbc.properties" }, encoding = "UTF-8")
public class DBConfig
{
	/*
	 * @Autowired Environment env;
	 * @Autowired private DataSource dataSource;
	 */
	/*
	 * @Bean(destroyMethod = "close",value="dataSource") public DataSource
	 * dataSource() { BasicDataSource ds = new BasicDataSource(); String driver
	 * = env.getProperty("jdbc.driver"); ds.setDriverClassName(driver); String
	 * url = env.getProperty("jdbc.url"); ds.setUrl(url); String username =
	 * env.getProperty("jdbc.username"); ds.setUsername(username); String
	 * password = env.getProperty("jdbc.password"); ds.setPassword(password);
	 * ds.setTestOnBorrow(true); ds.setValidationQuery("select 1 from dual");
	 * return ds; }
	 * @Bean public DataSourceTransactionManager dataSourceTransactionManager()
	 * { DataSourceTransactionManager dataSourceTransactionManager = new
	 * DataSourceTransactionManager();
	 * dataSourceTransactionManager.setDataSource(dataSource); return
	 * dataSourceTransactionManager; }
	 * @Bean(value="sqlSessionFactory") public SqlSessionFactory
	 * sqlSessionFactory() throws Exception { SqlSessionFactoryBean bean=new
	 * SqlSessionFactoryBean(); bean.setDataSource(dataSource);
	 * org.apache.ibatis.session.Configuration configuration=new
	 * org.apache.ibatis.session.Configuration(); configuration.addMappers(
	 * env.getProperty("mapping")); bean.setConfiguration(configuration);
	 * SqlSessionFactory factory= bean.getObject(); return factory; }
	 * @Bean public MapperScannerConfigurer mapperScannerConfigurer() {
	 * MapperScannerConfigurer bean=new MapperScannerConfigurer();
	 * bean.setSqlSessionFactoryBeanName("sqlSessionFactory"); String
	 * packge=env.getProperty("dao"); bean.setBasePackage(packge); return bean;
	 * }
	 */
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy