Announcement Announcement Module
Collapse
No announcement yet.
proxyTargetClass set true and false in same xml ignored Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • proxyTargetClass set true and false in same xml ignored

    Hi
    The documentation says "you can have multiple <aop-config/>
    elements, with some configured to force CGLIB-based proxying and some not to." However, when I do exactly that Spring AOP only seems to care about the presence of CGLIB. I want to have JDK-proxies and CGLIB. Here my configuration:

    Code:
    <aop:config proxy-target-class="true">
    		<aop:aspect id="optimisticOperationRetry"
    			ref="optimisticOperationExecutor">
    			<aop:pointcut id="idempotentOperation"
    				expression="execution(* com.mucsillc.service.*.*(..))" />
    			<aop:around pointcut-ref="idempotentOperation"
    				method="doOptimisticOperation" />
    		</aop:aspect>
    		
    	</aop:config>
    	
    	<aop:config proxy-target-class="false">
    		<aop:aspect id="optimisticOperationRetry2"
    			ref="optimisticOperationExecutor2">
    			<aop:pointcut id="idempotentOperation2"
    				expression="execution(* com.fds.service.*.*(..))" />
    			<aop:around pointcut-ref="idempotentOperation2"
    				method="doOptimisticOperation" />
    		</aop:aspect>
    		
    	</aop:config>
    Any ideas?

  • #2
    Hi Janos

    That is unfortunately an error in the reference documentation; the mixing of class- and interface-based proxies in the context of auto-proxying was pushed back to the Spring 2.1 timeframe and the reference documentation was not updated to reflect that. Please do accept my apologies in this regard, because I know what it feels like to bang one's head against a brick wall (if indeed you eneded up banging your head against a brick wall).

    So to be clear (I am about to amend the reference documentation): if you have even one <aop:config/> section with proxy-target-class="true", then CGLIB-based proxying will be in effect for all auto-created proxies.

    By way of an answer to your issue (namely that you want to have a mixture of class- and interface-based proxies), you will have to use explicit proxy definitions for those beans that you want to generate class-based proxies.

    Cheers
    Rick

    Comment

    Working...
    X