<!--spring的基于xml的声明式事务控制-->
<!--1.配置事务管理器-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!--注入数据源-->
<property name="dataSource" ref="driverManagerDataSource"></property>
</bean>
<!--2.配置事务的通知-->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="transfer"
isolation="DEFAULT"
propagation="REQUIRED"
timeout="-1"
read-only="false"
rollback-for=""
no-rollback-for=""/>
<!--<tx:method name="find*"/>-->
</tx:attributes>
</tx:advice>
<!--3.配置aop-->
<aop:config>
<aop:pointcut id="pt1" expression="execution(* service.impl.AccountServiceImpl.*(..))"></aop:pointcut>
<aop:advisor advice-ref="txAdvice" pointcut-ref="pt1"></aop:advisor>
</aop:config>
<aop:pointcut>标签定义了切入点,也就是告诉spring,我要在这个切入点范围内进行事物控制了
<tx:method>标签定义了具体进行事务管理的方法,这些方法才真正具有事务管理的属性,pointcut的范围应该包含method