spring-framework / org.springframework.beans / CachedIntrospectionResults / acceptClassLoader

acceptClassLoader

open static fun acceptClassLoader(@Nullable classLoader: ClassLoader): Unit

Accept the given ClassLoader as cache-safe, even if its classes would not qualify as cache-safe in this CachedIntrospectionResults 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 #clearClassLoader call at application shutdown.

Parameters

classLoader - the ClassLoader to accept