Description
Affects: 5.3
There's a problem in Spring Boot's DevTools that's caused by an AOP proxy being created using the restart class loader rather than the class loader of the proxy's target. This causes problem when calling package-private methods on the proxy.
I've hacked together something that overrides the proxy creator to use the target's class loader and it fixes the problem. I'd now like to explore how we could make the solution more robust and I think some Framework changes are required. The override of AbstractAutoProxyCreator.createProxy is only changing the behaviour of a single line:
Rather than using getProxyClassLoader()
, my override uses beanClass.getClassLoader()
.
The other part of the problem is then configuring the context to use the customized AnnotationAwareAspectJAutoProxyCreator
. I'm changing the class of its bean definition at the moment. Perhaps there's already a more elegant way to do this?