|
From: Rod J. <rod...@in...> - 2004-06-19 22:38:15
|
Alef >While setting up a configuration at work, I made a slight mistake and added a TransactionManager as an interceptor to the ProxyFactoryBean instead of the TransactionInterceptor itself. I finally found it out after an hour or so but was wondering why it's possible to mention a targetsource as an interceptor in the first place. >Secondly, it's now possible to have a PFB mentioning two target sources, where only the one added to the interceptor (or list of advices, like you refactored it to last week) will be used and the one references using the targetSource property is completely ignored. >I've added a corresponding testcase to ProxyFactoryBeanTests (testDoubleTargetSource) to show this behavior. >Would it be wise to add a check preventing users from mentioning both properties? Also, I'm still wondering why one would add a target source to the list of interceptors instead of just mentioning it separately using the targetSource property. It might be better (just for clarity) to not even allow it, or are there any clear use cases? These are good points. Basically the reason for this is historical. The "old" way of specifying a TargetSource--in the days when a similar role was performed by an InvokerInterceptor--was to add it to the end of the interceptor list. When I introduced the TargetSource, I permitted the old specification method in interceptorNames, for backward compatibility. (The most important case is where you specify a target directly, from which it will create a target source). I have changed ProxyFactoryBean so that double specification is not possible. Thanks for adding the test: you did most of the work. I just had to change what the test required to pass. I've taken no action on allowing the TargetSource in the list of interceptors. It's a bit of a shorthand, so it arguably has some value. However, it's good to avoid needless duplication of ways to do something. So maybe we should transition it out. However, as it isn't a method it can't be deprecated -:) I have also checked to ensure that double specification of the TargetSource via 2 entries in the interceptorNames list is prevented also. Rgds Rod ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |