| <!–声明事务–> < bean id=”txManager”> < property name=”sessionFactory” ref=”sessionFactory” /> < /bean> < !– 创建通知–> < tx:advice id=”txAdvice” transaction-manager=”txManager”> < tx:attributes> < tx:method name=”find*” read-only=”true”/> < tx:method name=”has*” read-only=”true”/> < tx:method name=”add*” propagation=”REQUIRED” /> < tx:method name=”alter*” propagation=”REQUIRED” /> < tx:method name=”upd*” propagation=”REQUIRED” /> < tx:method name=”del*” propagation=”REQUIRED” /> < tx:method name=”exec*” propagation=”REQUIRED” /> < /tx:attributes> < /tx:advice> < !– 切入接口所在的包 –> < aop:config> < aop:pointcut id=”serviceOperation” expression=”execution(public * org.bgi.*.service.*.*(..))” /> < aop:advisor advice-ref=”txAdvice” pointcut-ref=”serviceOperation” /> < /aop:config> (文章来源:http://www.mfqyw.com/) |
在Spring中配置Service层方法的事务
最新推荐文章于 2024-07-16 17:08:07 发布
本文详细介绍了在Spring框架中如何配置事务管理器、创建通知,并应用到特定的业务操作上,确保了数据的一致性和操作的正确性。

2684

被折叠的 条评论
为什么被折叠?



