<aop:config proxy-target-class="true"> <aop:pointcut expression="execution(* com.jikexueyuan.dao.impl.*.*(..))" id="cut"/> <aop:advisor advice-ref="defaultTransactionAdvice" pointcut-ref="cut"/> </aop:config> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> <property name="dataSource" ref="datasource"></property> </bean> <tx:advice transaction-manager="transactionManager" id="defaultTransactionAdvice"> <tx:attributes> <tx:method name="add*" read-only="false"/> <tx:method name="*"/> </tx:attributes> </tx:advice>
本文介绍了一种使用 Spring AOP 和 Hibernate 进行事务管理的配置方式。通过定义切入点表达式、通知器和事务属性,实现了对指定包下所有方法的事务控制。
804

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



