java.beans.PropertyDescriptor
information 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
a static factory method to obtain instances.
forClass(java.lang.Class)
acceptClassLoader(java.lang.ClassLoader)clearClassLoader(java.lang.ClassLoader)forClass(java.lang.Class)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.
Any acceptClassLoader call at application startup should
be paired with a call at application shutdown.
clearClassLoader(java.lang.ClassLoader)
classLoader the ClassLoader to acceptWe don't want to use synchronization here. Object references are atomic, so we can live with doing the occasional unnecessary lookup at startup only.
beanClass the bean class to analyzeBeansException in case of introspection failurelogger.debug("Not strongly caching class [" + beanClass.getName() + "] because it is not cache-safe");
classLoader the ClassLoader to checkacceptClassLoader(java.lang.ClassLoader)beanClass the bean class to analyzeBeansException in case of introspection failurethrow new FatalBeanException("Cannot get BeanInfo for object of class [" + beanClass.getName() + "]", ex);