0
votes

Is DefaultAutoProxyCreator needed if tx:annotation-driven is already enabled ?

<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
        <property name="proxyTargetClass" value="true" />
</bean>

<tx:annotation-driven proxy-target-class="true"/>

It seems when there are both of them enabled, then proxy of proxies start getting created and starts failing.

Having only tx-annotation enabled, I have disabled spring-aspect and cglib also in maven dependencies. Do I need to have cglib even in Spring 4 for class based proxies like above ?

Spring version : 4.0.6

1

1 Answers

1
votes

As far as I understand, you don't really need the explicit DefaultAdvisorAutoProxyCreator unless you have specific Advisors that you are using for cross cutting purpose - if so I feel that an @AspectJ approach may be cleaner.

Also, disabling cglib explicitly does not have any effect, Spring comes packaged with its own copy of CGLIB.