Proxy created with IntroductionInterceptor
but without target
always throws an exception
#33985
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: regression
A bug that is also a regression
Milestone
Hi, I'm from Atlassian DC team. Our products are using Gemini Blueprint that integrates Spring into OSGi framework. I'm working on adding support for Spring 6.2 and I detected regression caused by #31304
Gemini defines proxies without
target
, instead it adds several mix-ins by adding custom advices implementingDelegatingIntroductionInterceptor
. That interceptor registers all interfaces defined by the implementing subclass. Those interfaces are later registered inProxyFactory
. New code validates registered interfaces inProxyFactory
with interfaces from all registeredIntroductionAdvisor
with use of a methodorg.springframework.aop.framework.AdvisedSupport#hasUserSuppliedInterfaces
. Effectively that method returnstrue
only ifProxyFactory
defines at least one interface that isn't defined by one of the registeredIntroductionAdvisor
.In some cases the requested interfaces may be the same as defined in registered
IntroductionAdvisor
. MethodhasUserSuppliedInterfaces
will returnfalse
andProxyFactory
will follow with default pattern, resulting in an exception:The update linked above effectively changed the definition of an "user interface". It used to be any interface that is not
SpringProxy
. Right now it is an interface that isn'tSpringProxy
and isn't one of the interfaces defined byIntroductionAdvisor
. It caused a regression in Gemini use case. It looks like if there is notarget
but there are any interfaces,ProxyFactory
should still try to useJdkDynamicAopProxy
. That change would maintain behvaviour existing for many years before the recent update.Example Code:
The text was updated successfully, but these errors were encountered: