You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doc: Using <aop:config> namespace with different 'proxy-target-class' settings for two different objects makes usage of CGLIB proxy only [SPR-3459]
#8142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
from console messages, no JDK proxying is applied, unless both 'proxy-target-class' settings are set to 'false'.
Advices are applied on both classes, only that CGLIB proxying mechanisms is used for both.
This is the test class:
public class AopDebugInterceptorTests2 extends
AbstractDependencyInjectionSpringContextTests {
This is one of the beans, identical with the second one (second bean implements AopMockBeanInterface2, which is identical with AopMockBeanInterface):
public class AopMockBean implements AopMockBeanInterface {
private String prop;
public String getProp() {
return prop;
}
public void setProp(String prop) {
this.prop = prop;
}
public String displayProp() {
return "1 " + prop;
}
}
public interface AopMockBeanInterface {
public String displayProp();
}
This is the interceptor:
public class DebugInterceptor implements MethodInterceptor {
This is actually the expected behavior: Multiple aop:config sections are collapsed into a single unified auto-proxy creator at runtime, which applies the 'strongest' settings that any of the aop:config sections (typically from different XML bean definition files) specified. This is why you're seeing the CGLIB proxy used for all AOP advices here...
This is probably not explicitly documented anywhere at this point. Hence I'm changing this into a documentation issue, assigned to Rick for the 2.1 timeframe.
If I understand correctly, using proxy-target-class="true" on tx:annotation-driven, aop:aspectj-autoproxy or aop:config will force the use of CGLIB proxies for all three of them. Is this a correct summary?
Yes, this summary is correct. However, as you recently reported, aop:aspectj-autoproxy wasn't behaving as intended there... which will be fixed in 2.0.6 / 2.1 M3.
Andrei Stefan opened SPR-3459 and commented
Hi,
For the following configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean id="debuggingAspect" class="com.interceptor.DebugInterceptor" />
</beans>
from console messages, no JDK proxying is applied, unless both 'proxy-target-class' settings are set to 'false'.
Advices are applied on both classes, only that CGLIB proxying mechanisms is used for both.
This is the test class:
public class AopDebugInterceptorTests2 extends
AbstractDependencyInjectionSpringContextTests {
}
This is one of the beans, identical with the second one (second bean implements AopMockBeanInterface2, which is identical with AopMockBeanInterface):
public class AopMockBean implements AopMockBeanInterface {
private String prop;
}
public interface AopMockBeanInterface {
public String displayProp();
}
This is the interceptor:
public class DebugInterceptor implements MethodInterceptor {
}
Tested this configuration using spring-framework-2.0.5-20070506-82.zip jar files.
Affects: 2.0.5
Issue Links:
The text was updated successfully, but these errors were encountered: