<!--通知-->
<tx:advice id="transferAdv" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="transfer" rollback-for="java.lang.Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="pt1" expression="execution(* com.itheima.service.impl.*.*(..))"/>
<!--2. 配置事务通知-->
<aop:advisor advice-ref="transferAdv" pointcut-ref="pt1"></aop:advisor>
</aop:config>
1.帮我们创建了事务通知和对应的方法
2.帮我们连接了事务通知和事务管理者transactionManager
为了做到这一点,需要做什么?
1.添加事务注解的驱动
<tx:annotation-driven/>
2.在需要执行事务的类(AccountServiceImpl)上加注解@Transactional 标明该类需要使用事务
这样注解驱动会扫描注解,然后直接把该类和事务管理者连接起来。