|
From: Kopylenko, D. <dko...@ac...> - 2003-08-23 08:26:23
|
Hi everybody, TransactionProxyFactoryBean now supports MethodPointcut property, so now it's possible to cause a conditional invokation of TransactionInterceptor based on method name and attributes. The default is AlwaysInvoked method pointcut. It could be set like this: <bean id="myBusinessRegexpPointcut" class="org.springframework.aop.framework.RegexpMethodPointcut"> <property name="pattern"><value>*myBusiness*</value></property> </bean> <bean id="myBusinessService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe an"> <property name="transactionManager"><ref bean="myTransactionManager"/></property> <property name="target"><ref bean="myBusinessServiceTarget"/></property> <property name="methodPointcut"><ref bean="myBusinessRegexpPointcut"/></property> <property name="proxyInterfacesOnly"><value>true</value></property> <property name="transactionAttributes"> <props> <prop key="myBusiness*">PROPAGATION_REQUIRED</prop> <prop key="myBusinessMethod">PROPAGATION_MANDATORY</prop> </props> </property> </bean> So suppose in your Business Object not all the methods are "transactional", so you could define a pointcut just for those tx methods and when a non-tx method is invoked on the Proxy, the Tx interceptor does not get invoked alltogether, passing the invokation right to the target object. Regards, Dmitriy. |