<?xml version="1.0" encoding="UTF-8"?>
<beans 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/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<bean id="<此名随便>" class="<对应的DAO里的类>">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="<此名随便>" class="<对应的Biz里的类>">
<property name="<对应Biz类里的DAO属性>" ref="<对应DAO的ID>"></property>
</bean>
<bean name="</页面提交的Action路径>" class="<对应的Action里的类>">
<property name="<对应Action类里的Biz属性>" ref="<对应的Biz的ID>"></property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="bizMethods"
expression="execution(* <Biz包的路径>.*.*(..))" />
<aop:advisor advice-ref="txAdvice"
pointcut-ref="bizMethods" />
</aop:config>
</beans>
