introducing a real connection pool
This commit is contained in:
parent
812ea5881e
commit
270bd5b707
|
@ -24,7 +24,7 @@
|
|||
</dependency>
|
||||
|
||||
<!-- persistence -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
|
@ -47,6 +47,12 @@
|
|||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-dbcp</artifactId>
|
||||
<version>7.0.41</version>
|
||||
</dependency>
|
||||
|
||||
<!-- validation -->
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Properties;
|
|||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.tomcat.dbcp.dbcp.BasicDataSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
@ -11,7 +12,6 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
|
||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||
import org.springframework.orm.hibernate4.HibernateTransactionManager;
|
||||
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
@ -43,7 +43,7 @@ public class PersistenceConfig {
|
|||
|
||||
@Bean
|
||||
public DataSource restDataSource() {
|
||||
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
||||
final BasicDataSource dataSource = new BasicDataSource();
|
||||
dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName")));
|
||||
dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url")));
|
||||
dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user")));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
||||
<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
|
||||
<property name="driverClassName" value="${jdbc.driverClassName}" />
|
||||
<property name="url" value="${jdbc.url}" />
|
||||
<property name="username" value="${jdbc.user}" />
|
||||
|
|
Loading…
Reference in New Issue