|
From: Colin S. <col...@ex...> - 2003-09-24 16:04:09
|
Dmitry, I just noticed that your update is not correct. You changed the 'proxyInterfaces' value in the ProxyFactoryBean use to be the name of the business impl class name. What should in fact have been changed is in the TransactionInterceptor parameter 'transactionAttributeSource', the use of the business interface name instead of the business impl class name. So I have changed bad the proxyInterfaces value to be the business interface name, and modified the transactionAttributeSource to use the interface as well. I have not touched your other modification, to add an example of the use of TransactionProxyFactoryBean... Regards, Colin Kopylenko, Dmitry wrote: >Colin, > >I'll update it in the CVS. > >Regards, >Dmitriy. > >-----Original Message----- >From: Colin Sampaleanu [mailto:col...@ex...] >Sent: Wednesday, September 03, 2003 6:35 PM >To: 'springframework-developer ' >Cc: ben...@ac... >Subject: [Springframework-developer] TransactionInterceptor setup in the >webapp-aop skeleton file is bad > > >In the file > samples/skeletons/webapp-aop/WEB-INF/applicationContext.xml >there is an example of how to set up a transaction interceptor. It is >using the old mechanism, which is not the problem, but is wrong, which >is the problem. > >The example uses > <bean id="exampleTransactionInterceptor" >class="org.springframework.transaction.interceptor.TransactionInterceptor"> > <property name="transactionManager"><ref >bean="myTransactionManager"/></property> > <property name="transactionAttributeSource"> > <value> > >example.ExampleBusinessObject.exampleMethod=PROPAGATION_REQUIRED > >example.ExampleBusinessObject.anotherExampleMethod=PROPAGATION_REQUIRED > </value> > </property> > </bean> > <bean id="exampleBusinessObject" >class="org.springframework.aop.framework.ProxyFactoryBean"> > <property >name="proxyInterfaces"><value>example.ExampleBusinessInterface</value></prop >erty> > <property >name="interceptorNames"><value>exampleTransactionInterceptor,exampleBusiness >ObjectTarget</value></property> > </bean> > >Now this is specifyng that ExampleBusinessObject.exmpleMethod and >ExampleBuisnessObject.anotherExampleMethod should be intercepted and >handled transactionally, but if the user comes in via the interface >ExampleBusinessInterface like he should be, then the interceptor will >not match up on the method names, since the class he is coming in as is >ExampleBusinessInterface not the ExampleBusinessObject the interceptor >is looking for. > >This is the exact problem that Ben Alex was having last week (but I >didn't spot it at the time). Hopefully he didn't give up on spring yet :-) > >Can somebody fix this? Also, fwiw this doesn't happen with the new, >streamlined mechanism, TransactionProxyFactoryBean, since there you >directly point to the object you are proxying, and match the method >coming in regardless. > >Also, it's probably worth updating the example to show both the old >mechanism and the new one. > >Regards, >Colin > > |