public class CachedIntrospectionResults extends java.lang.Object
PropertyDescriptorinformation for a Java class. Not intended for direct use by application code.
Necessary for own caching of descriptors within the application's ClassLoader, rather than rely on the JDK's system-wide BeanInfo cache (in order to avoid leaks on ClassLoader shutdown).
Information is cached statically, so we don't need to create new
objects of this class for every JavaBean we manipulate. Hence, this class
implements the factory design pattern, using a private constructor and
forClass(Class) factory method to obtain instances.
|Modifier and Type||Method and Description|
Accept the given ClassLoader as cache-safe, even if its classes would not qualify as cache-safe in this CachedIntrospectionResults class.
Clear the introspection cache for the given ClassLoader, removing the introspection results for all classes underneath that ClassLoader, and deregistering the ClassLoader (and any of its children) from the acceptance list.
public static void acceptClassLoader(java.lang.ClassLoader classLoader)
This configuration method is only relevant in scenarios where the Spring classes reside in a 'common' ClassLoader (e.g. the system ClassLoader) whose lifecycle is not coupled to the application. In such a scenario, CachedIntrospectionResults would by default not cache any of the application's classes, since they would create a leak in the common ClassLoader.
acceptClassLoader call at application startup should
be paired with a
clearClassLoader(java.lang.ClassLoader) call at application shutdown.
classLoader- the ClassLoader to accept
public static void clearClassLoader(java.lang.ClassLoader classLoader)
classLoader- the ClassLoader to clear the cache for