<?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:p="http://www.springframework.org/schema/p"
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.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="wea" class="com.t29.dao.We">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="tst" class="com.t29.action.UserInfo">
<property name="w" ref="wea"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!-- 声明式事务 -->
<!-- 事务管理器 -->
<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager"
id="transactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 事务的通知方式 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- aop配置事务声明 -->
<aop:config>
<aop:pointcut expression="execution(* com.t29.action.*.*(..))"
id="bizMethod" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethod"/>
</aop:config>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
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.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="wea" class="com.t29.dao.We">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="tst" class="com.t29.action.UserInfo">
<property name="w" ref="wea"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!-- 声明式事务 -->
<!-- 事务管理器 -->
<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager"
id="transactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 事务的通知方式 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- aop配置事务声明 -->
<aop:config>
<aop:pointcut expression="execution(* com.t29.action.*.*(..))"
id="bizMethod" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethod"/>
</aop:config>
</beans>