- 
        Couldn't load subscription status. 
- Fork 38.8k
Description
Paul Austin opened SPR-9189 and commented
If a class loaded by the system class loader (null) then it is cached by the CachedIntrospectionResults class. However there is no way to clear this item from the cache as clearClassLoader ignores null class loader arguments.
This means that the classCache will include a reference to the CachedIntrospectionResults thus preventing in some cases CachedIntrospectionResults from being garbage collected.
The class that causes this problem in my spring + spring security app is ArrayList. It seems to happen when I include a task scheduler in my application.
I tried to create a simple test case below. But it was able to unload the classes in this case.
public class TestListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent sce) {
CachedIntrospectionResults.acceptClassLoader(Thread.currentThread()
.getContextClassLoader());
BeanUtils.getPropertyDescriptors(ArrayList.class);
}
public void contextDestroyed(ServletContextEvent sce) {
CachedIntrospectionResults.clearClassLoader(Thread.currentThread()
.getContextClassLoader());
}
}
Affects: 3.0.7
Backported to: 3.1.4