-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
Graeme Rocher opened SPR-4153 and commented
In Grails we have a custom class loader that reloads classes when they are changed. Previously Spring's AOP support had no problem with this, but with Spring 2.5 and cglib proxies CGLib, what happens is when we reload a class we get a ClassCastException.
The problem appears to be the Enhancer class in CGLib, it will cache classes based on their originating ClassLoader. This may be fine for Java systems, but with Groovy and Grails we use a reloading capable class loader.
The problem is even bigger because there is no way in Spring to disable caching using the useCache property defined in AbstractClassGenerator.
If there was some way in ProxyFactoryBean and AbstractSingletonProxyFactoryBean to set to disable class caching in CGLib we could get round this. The original issue in the Grails JIRA is:
http://jira.codehaus.org/browse/GRAILS-1771
For the moment my solution is the wrap the classloader in another class loader by passing the class loader as a parent to a child classloader. But this may have other side effects and is generally undesirable.
Affects: 2.5 final
Issue Links:
- Support for ByteBuddy as an alternative to CGLIB [SPR-8190] #12840 Support for ByteBuddy as an alternative to CGLIB ("is depended on by")
3 votes, 5 watchers