SPR-5429 Update Pet Clinic to use HSQL as an embedded database

Created DbcpDataSourceFactory factory bean to create and populate a dbcp based connection pool.  The factory bean is based on EmbeddedDataSourceFactory from the JavaConfig version of Pet Clinic.  The new DbcpDataSourceFactory has been tested with HSQL in embedded and stand-alone modes.
This commit is contained in:
Scott Andrews
2009-01-23 20:33:17 +00:00
parent 9335233618
commit 16c9391069
6 changed files with 404 additions and 10 deletions

View File

@@ -20,13 +20,17 @@
<context:property-placeholder location="classpath:jdbc.properties"/>
<!--
Uses Apache Commons DBCP for connection pooling. See Commons DBCP documentation
for the required JAR files. Alternatively you can use another connection pool
such as C3P0, similarly configured using Spring.
Spring FactoryBean that creates a DataSource using Apache Commons DBCP for connection
pooling. See Commons DBCP documentation for the required JAR files. This factory bean
can populate the data source with a schema and data scripts if configured to do so.
An alternate factory bean can be created for different connection pool implementations,
C3P0 for example.
-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}"
p:password="${jdbc.password}"/>
<bean id="dataSource" class="org.springframework.samples.petclinic.config.DbcpDataSourceFactory"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
p:username="${jdbc.username}" p:password="${jdbc.password}" p:populate="${jdbc.populate}"
p:schemaLocation="${jdbc.schemaLocation}" p:dataLocation="${jdbc.dataLocation}"/>
<!-- JNDI DataSource for JEE environments -->
<!--