SpringSource/spring-framework — pull request #332 by byungseok (2013-08-13 06:40:45+00:00)
Title: Array type bean cannot be proxied because is is final class

AnnotationAwareAspectJAutoProxyCreator(AbstractAutoProxyCreator) class
has wrapIfNecessary() method. In this method, Spring AOP tries to
figure out whether current bean must be proxied or not.

Because array type bean is not skipped with current code,
AnnotationAwareAspectJAutoProxyCreator tries to create proxy having
interfaces which array class implements.(java.lang.Cloneable, etc)
Following Aspect could produce this with <jdbc:embedded-database>.

@Around("target(org.springframework.core.io.Resource[])")

Maybe this is usage error case, but repro project attached in issue
(https://jira.springsource.org/browse/SPR-10793) shows side effect
of above situation(absence of array type skipment).

Bean <jdbc:embedded-database> has inner bean <jdbc:script>, and inner
bean is type of org.springframework.core.io.Resource[]. Although
configured aspect was @Around("bean(foo)"), inner bean <jdbc:script>
was proxied resulting java.lang.IllegalArgumentException: Cannot
convert value of type [com.sun.proxy.$Proxy6 implementing...........

Invalid pointcut match was problem of aspectweaver, but if array type
bean can be skipped from wrapIfNecessary() method, this side effect
could be eliminated.

Thank you.

Issue: SPR-10793