JdbcClinicTests-context.xml

31 lines | 1.584 kB Blame History Raw Download
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
	xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">

	<context:property-placeholder location="classpath:spring/jdbc.properties"/>

	<context:annotation-config/>

	<tx:annotation-driven/> 

	<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}"/>

	<jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
		<jdbc:script location="${jdbc.initLocation}"/>
		<jdbc:script location="${jdbc.dataLocation}"/>
	</jdbc:initialize-database>

	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
		p:dataSource-ref="dataSource" />

	<bean class="org.springframework.samples.petclinic.jdbc.JdbcClinic" />

</beans>