AOP auto-proxying with proxyTargetClass=true and introduction advice does not work for JDK proxy targets #27044
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
See spring-projects/spring-retry#214 (comment)
Spring retry uses AOP auto proxy to add a proxy for
@Retryable
methods; the code unconditionally wraps the target in a new proxy. IfproxyTargetClass
is true (default in Spring Boot), theAbstractAutoProxyCreator
does not add interfaces if the target is a JDK proxy.This causes, for example,
@Retryable
on a spring data repository to create an invalid beanThe inner (spring-data) proxy implements
TestRepository
, etc, but the outer proxy only implements theRetryable
interceptor interface.Although the error message is wrong (spring-projects/spring-boot#26821), it is because the proxy only implements
Retryable
.Perhaps the
AbstractAutoProxyCreator
could detect that the target is a JDK proxy and copy the interfaces (even whenproxyTargetClass
) is true?The text was updated successfully, but these errors were encountered: