UserDAOTest.java读取的test-common文件内容 : <?xmlversion="1.0"encoding="GB2312"?><beansdefault-autowire="byName"xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<!-- for unitils test, read unitls.properties --> <bean id="dataSource"class="org.unitils.database.UnitilsDataSourceFactoryBean"/>
<beanid="transactionTemplate"class="org.springframework.transaction.support.TransactionTemplate"/>
<beanid="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" scope="singleton">
<propertyname="configLocation"value="classpath:resources/sqlmap-config.xml"/>
<propertyname="dataSource"ref="dataSource"/>
</bean>
<beanid="amoebaDao"class="com.ali.amoeba.brmmstest.ibatis.IBatisAmoebaDao">
<propertyname="sqlMapClient"ref="sqlMapClient"/>
</bean>
<beanid="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager" scope="singleton">
<propertyname="dataSource"ref="dataSource"/>
</bean>
<beanid="baseSqlMapClientDAO"abstract="true"> <propertyname="dataSource">
<reflocal="dataSource"/>
</property>
<propertyname="sqlMapClient">
<reflocal="sqlMapClient"/>
</property>
</bean>
</beans>
以上变化仅仅是 <bean id="dataSource"class="org.unitils.database.UnitilsDataSourceFactoryBean"/>
就是UnitilsDataSourceFactoryBean去读取unitils.properities文件驱动程序及控制项目.其他的和spring testcontext读取的内容完全一样.
运行后amoeba数据库自动生成dbmaintain_scripts,可以清晰看出执行的脚本版本.