1<?xml version="1.0" encoding="UTF-8"?> 2<beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xmlns:aop="http://www.springframework.org/schema/aop" 5 xmlns:tx="http://www.springframework.org/schema/tx" 6 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 7 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 8 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 9 10 <aop:config> 11 <aop:advisor pointcut="execution(* *..ITestBean.*(..))" advice-ref="txAdvice"/> 12 </aop:config> 13 14 <tx:advice id="txAdvice"> 15 <tx:attributes> 16 <tx:method name="get*" read-only="true"/> 17 <tx:method name="set*"/> 18 <tx:method name="exceptional"/> 19 </tx:attributes> 20 </tx:advice> 21 22 <tx:advice id="txRollbackAdvice"> 23 <tx:attributes> 24 <tx:method name="get*" rollback-for="java.lang.Exception"/> 25 <tx:method name="set*" no-rollback-for="java.lang.RuntimeException"/> 26 </tx:attributes> 27 </tx:advice> 28 29 <bean id="transactionManager" class="org.springframework.transaction.CallCountingTransactionManager"/> 30 31 <bean id="testBean" class="org.springframework.beans.TestBean"/> 32 33</beans> 34