?????????????????????????????????????????????????????????????????;???????д??????????漰?????????????????????????????DAO??;??????????????????????????????????;??????????÷???????????????????????????Dao?е????д????????????????????????? ?????? ???????????Ч???????????????ú?????????tomcat?????????????????????????????????????weblogic????????????? ????????????????????????????????????????Dao ????????????????????????? ??????Щ??????dao?????????????????????????????? ??????????е???????? ;??????????????????spring+ibatis+junit???????????? ???崠??????
?????  ??????????????? AbstractTestCase ????????
????package com.skywin.workorder.dao;
????import org.springframework.context.ApplicationContext;
????import org.springframework.context.support.ClassPathXmlApplicationContext;
????import junit.framework.TestCase;
????public abstract class AbstractTestCase extends TestCase {
????protected ApplicationContext ctx = null;
????public AbstractTestCase() {
????// ?????????
????//ctx = new ClassPathXmlApplicationContext("testApplicationContext.xml");
????// ????DAO
????ctx =new ClassPathXmlApplicationContext(
????"_applicationContext-iBatis.xml");
????}
????}
?????? ?????????? _applicationContext-iBatis.xml ??·??? ????????conf\_applicationContext-iBatis.xml ????spring?????????????????????????????  ????????:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!--
<import  resource="classpath:_applicationContext-authrization.xml"/>
-->
<import  resource="classpath:workorder-module.xml"/>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>jdbc-template.properties</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="maxActive" value="${jdbc.maxActive}"/>
</bean>
<!--
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@10.244.112.130:41521:gmcctest"/>
<property name="username" value="gmcc"/>
<property name="password" value="gmcc"/>
<property name="initialSize" value="1"/>
<property name="maxActive" value="15"/>
</bean>
-->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="sqlmap-config-template.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="baseTxService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="transactionManager"/>
<property name="proxyTargetClass" value="true"/>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED??readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED??readOnly</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<!--  instead of  select .. for update
<prop key="global*">
PROPAGATION_REQUIRED??ISOLATION_SERIALIZABLE
</prop>
-->
</props>
</property>
</bean>
</beans>