Bug report

Bug report and reason is explained very well here #26266.

In the cglib side, this issue #80 is the consequence of trying to solve CallbackFilter leak. As vlsi said

"weakly reachable CallbackFilters" and "classloader reuse" do not play together well.

Solution

  • This solution is to try to reduce the leak by make advisors and advisorChainFactory WeakReference , so that there should have no chance to leak 'big object'. Think about class created by cglib is also 'leaked', I think that should be acceptable.

  • Another quick solution is to make AbstractAutoProxyCreator implements DisposableBean, clear CallbackFilter field in generated class.

Comment From: snicoll

Thanks for the PR and sorry it got overlooked but https://github.com/spring-projects/spring-framework/issues/26266 has been fixed in the meantime. Please give it a try if you can.