首先配置摸板 <!-- 代理模板 --> <bean id="txProxy"
lazy-init="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="transactionAttributes"> <props> <prop key="*">PROPAGATION_REQUIRED</prop> </props> </property> </bean>摸板配置好以后,每次要添加一个新的代理,只需要类似下面这样添加 <bean id="servicerProxy" parent="txProxy"> <property name="target"> <ref local="serviceTarget"/> </property> </bean>从而大大简化了代理的配置 |