?????????
????test?????·????system??manage???????(??????package??·?????????????????????????)???????????????spring?????????(???spring???????????????????test+?????+Context)???????鼶????????(?????????spring????????????????????????????и???)?????????·??????????DAO??service?????????е?DAO??service??????????????????????spring???????testApplicationContext.xml???????????????????????????????????????
testApplicationContext.xml
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>jdbc.properties</value>
</list>
</property>
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>${jdbc.driverClassName}</value>
</property>
<property name="url">
<value>${jdbc.url}</value>
</property>
<property name="username">
<value>${jdbc.username}</value>
</property>
<property name="password">
<value>${jdbc.password}</value>
</property>
</bean>
<bean id="parentSessionFactory" abstract="true"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop>
<prop key="hibernate.max_fetch_depth">3</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">
true
</prop>
</props>
</property>
<property name="dataSource">
<ref local="dataSource" />
</property>
</bean>
<!-- transaction -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="baseTransactionProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="*">
PROPAGATION_REQUIRED?? -ApplicationException
</prop>
<prop key="load*">PROPAGATION_REQUIRED??readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED??readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED??readOnly</prop>
<prop key="list*">PROPAGATION_REQUIRED??readOnly</prop>
</props>
</property>
</bean>
<!-- Base DAO -->
<bean id="baseDAO" abstract="true"
class="com.mycompany.myproject.framework.BaseDAOImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>