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

  • proxyTargetClass set true and false in same xml ignored

    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:

    <aop:config proxy-target-class="true">
    		<aop:aspect id="optimisticOperationRetry"
    			<aop:pointcut id="idempotentOperation"
    				expression="execution(* com.mucsillc.service.*.*(..))" />
    			<aop:around pointcut-ref="idempotentOperation"
    				method="doOptimisticOperation" />
    	<aop:config proxy-target-class="false">
    		<aop:aspect id="optimisticOperationRetry2"
    			<aop:pointcut id="idempotentOperation2"
    				expression="execution(* com.fds.service.*.*(..))" />
    			<aop:around pointcut-ref="idempotentOperation2"
    				method="doOptimisticOperation" />
    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.