标题:配置Spring AOP事务的基本步骤
-
新建一个applicationContext-tx.xml文件,配置一下内容
-
配置事务管理器
<bean id = “txManager” class="org.springframework.jdbc.datasource.DataSourceTransactionManager/> -
配置事务通知
<tx:advice id = “txAdvice” transation-manager = “txManager”><tx:attributes> <tx:method name="*" propagation="REQUIRED" read-only="false"/> </tx:attributes>
</tx:advice>
-
配置AOP的通用切入点表达式
aop:config
<aop:pointcut id = “point1” experssion=“execution(* com.lpy.service.impl..(…))”/>
<aop:advisor advice-ref = “txAdvice” pointcut-ref=“point1”/>
</aop:config>
-