spring的aop事务配置
2009-09-10 10:29
459 查看
Code:
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="create*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="updat*" propagation="REQUIRED" />
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 那些类的哪些方法参与事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.ssh.service..*(..))"/>
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
</aop:config>
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="create*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="updat*" propagation="REQUIRED" />
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 那些类的哪些方法参与事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.ssh.service..*(..))"/>
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
</aop:config>
相关文章推荐
- spring(七)AOP,事务的隔离级别、传播特性、配置
- spring AOP 事务配置
- spring context.xmL配置数据库事务以及aop
- Spring 2.0 AOP 与事务配置突破
- 在Spring中采用声明式方法对Hibernate和JDBC进行统一的事务配置(AOP)
- spring aop事务配置,事务回滚
- Spring 配置 ——事务:aop:config切入
- 基于spring的aop实现读写分离与事务配置
- Spring2.X以AspectJ 式AOP 配置事务
- Spring事务的配置详解:AOP配置数据库操作的事务
- Spring 2.0 AOP 与事务配置
- Spring 2.0 AOP 与事务配置
- Spring 2.0 AOP 与事务配置[资料]
- spring AOP 配置事务不起作用的问题(用Junit测试service)
- Spring实现数据库读写分离/spring事务配置解释(Annotation/Spring AOP/Reflection)
- spring aop+mybatis事务配置 junit起作用,tomcat不起作用
- 【spring】中的事务管理AOP配置.
- Spring 2.0 AOP与事务配置
- Spring的自动扫描、数据源配置、AOP和事务等配置
- applicationContext-common.xml 之spring tx:advice 和 aop:config 配置事务属性详解