您的位置:首页 > 编程语言 > Java开发

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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: