<!-- 注册事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- 注册事务通知 -->
<tx:advice id="fundAdvice" transaction-manager="transactionManager">
<!-- 设置事务属性 -->
<tx:attributes>
<!-- 设置连接点的事务属性 -->
<tx:method name="add*" isolation="DEFAULT" propagation="REQUIRED"/>
<tx:method name="buy*" isolation="DEFAULT" propagation="REQUIRED" rollback-for="FundException"/>
</tx:attributes>
</tx:advice>
<!-- AOP配置 -->
<aop:config>
<aop:pointcut expression="execution(* *..service.*.buyFund(..))" id="fundPC"/>
<aop:advisor advice-ref="fundAdvice" pointcut-ref="fundPC"/>
</aop:config>