<?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:jdbc="http://www.springframework.org/schema/jdbc"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd
		http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd">

	<jdbc:embedded-database id="dataSource" type="H2"/>

	<jdbc:initialize-database ignore-failures="DROPS">
		<jdbc:script location="org/springframework/integration/jdbc/schema-drop-h2.sql"/>
		<jdbc:script location="org/springframework/integration/jdbc/schema-h2.sql" />
	</jdbc:initialize-database>

	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource"/>
	</bean>

	<bean id="lockRegistry" class="org.springframework.integration.jdbc.lock.JdbcLockRegistry">
		<constructor-arg name="client" ref="lockClient"/>
	</bean>

	<bean id="lockClient" class="org.springframework.integration.jdbc.lock.DefaultLockRepository">
		<constructor-arg name="dataSource" ref="dataSource"/>
		<property name="insertQuery"
				  value="INSERT INTO INT_LOCK (REGION, LOCK_KEY, CLIENT_ID, CREATED_DATE) VALUES (?, ?, ?, ?)"/>
	</bean>

	<tx:annotation-driven/>

</beans>
