spring的事物配置
生活随笔
收集整理的這篇文章主要介紹了
spring的事物配置
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1 配置事物管理器
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource" /></bean>2 配置事物 <!-- 配置事物 --><tx:advice id="transactionAdvice" transaction-manager="transactionManager"><tx:attributes><tx:method name="add*" propagation="REQUIRED" /><tx:method name="insert*" propagation="REQUIRED" /><tx:method name="save*" propagation="REQUIRED" /><tx:method name="update*" propagation="REQUIRED" /><tx:method name="modify*" propagation="REQUIRED" /><tx:method name="edit*" propagation="REQUIRED" /><tx:method name="delete*" propagation="REQUIRED" /><tx:method name="remove*" propagation="REQUIRED" /><tx:method name="get*" propagation="SUPPORTS" /><tx:method name="find*" propagation="SUPPORTS" /><tx:method name="select*" propagation="SUPPORTS" /><tx:method name="load*" propagation="SUPPORTS" /><tx:method name="search*" propagation="SUPPORTS" /><tx:method name="*" propagation="SUPPORTS" /></tx:attributes></tx:advice>
3 對service所有方法進行攔截
<aop:config><aop:pointcut id="transactionPointcut" expression="execution(* com.nufront.euht.service..*.*(..))" /><aop:advisor pointcut-ref="transactionPointcut" advice-ref="transactionAdvice" /></aop:config>總結
以上是生活随笔為你收集整理的spring的事物配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: spring学习网址(博客)
- 下一篇: 短信发送:webservice调用第三方