Java tutorial
/* * Copyright 2011 GantzGulch, Inc. * * This file is part of GantzFileSharing. * * GantzFileSharing is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GantzFileSharing is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GantzFileSharing. If not, see <http://www.gnu.org/licenses/>. */ package com.gantzgulch.sharing.configuration; import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @Configuration @Profile("test") public class DataSourceContextTest { private static final Log LOG = LogFactory.getLog(DataSourceContextTest.class); public DataSourceContextTest() { LOG.debug("ctor"); } @Bean(name = "sharingDS") public DataSource sharingDataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("org.hsqldb.jdbcDriver"); dataSource.setUrl("jdbc:hsqldb:mem:sharing_db"); dataSource.setUsername("sa"); dataSource.setPassword(""); return dataSource; } }