<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright ${license.git.copyrightYears} the original author or authors.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
						http://www.springframework.org/schema/beans/spring-beans.xsd
       					http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"
	default-lazy-init="false">
	
<!-- 	<bean id="dataSource" class="org.hsqldb.jdbc.JDBCDataSource"> -->
<!-- 		<property name="url" value="jdbc:hsqldb:mem:autowire"/> -->
<!-- 	</bean> -->
	
	 <jdbc:embedded-database id="dataSourceFoo">
        <jdbc:script location="classpath:org/mybatis/spring/submitted/autowire/database-schema-foo.sql"/>
    </jdbc:embedded-database>

	 <jdbc:embedded-database id="dataSourceBar">
        <jdbc:script location="classpath:org/mybatis/spring/submitted/autowire/database-schema-bar.sql"/>
    </jdbc:embedded-database>
	
	
	<bean id="sqlSessionFactoryFoo" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSourceFoo" />
	</bean>
	
	<bean id="sqlSessionFactoryBar" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSourceBar" />
	</bean>
	
	<!-- If we simply comment out this bean, then the test runs -->
	<bean id="sqlSessionTemplateFoo" class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg index="0" ref="sqlSessionFactoryFoo"/>
		<constructor-arg index="1" value="SIMPLE"/>
		<constructor-arg index="2"><null/></constructor-arg>
	</bean>

	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="org.mybatis.spring.submitted.autowire" />
		<property name="markerInterface" value="org.mybatis.spring.submitted.autowire.IFoo" />
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactoryFoo" />
	</bean>

	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="org.mybatis.spring.submitted.autowire" />
		<property name="markerInterface" value="org.mybatis.spring.submitted.autowire.IBar" />
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactoryBar" />
	</bean>
</beans>