???????е?spring???????????????????????棬????????????spring???????ü?????????????????parentSessionFactory????????????????sessionFactory?????????????????????????????????????
testSystemContext.xml
<bean id="sessionFactory" parent="parentSessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingDirectoryLocations">
<list>
<value>
com/mycompany/myproject/domain/system/maps
</value>
</list>
</property>
</bean>
<!-- DAO -->
<bean id="userDAO" parent="baseDAO"
class="com.mycompany.myproject.module.system.dao.UserDAOImpl">
<constructor-arg>
<value>com.mycompany.myproject.domain.system.User</value>
</constructor-arg>
</bean>
<!-- Service -->
<bean id="userService" parent="baseTransactionProxy">
<property name="target">
<bean
class="com.mycompany.myproject.module.system.service.UserServiceImpl">
<property name="userDAO" ref="userDAO" />
</bean>
</property>
</bean>
?????????????У?????????????parentSessionFactory??sessionFactory?????????mappingDirectoryLocations
AbstractSystemTest.java
public abstract class AbstractSystemTest extends
AbstractTransactionalDataSourceSpringContextTests ...{
protected String[] getConfigLocations() ...{
String[] config = new String[] ...{ "testApplicationContext.xml"??
"system/testSystemContext.xml" };
return config;
}
}