org.springframework.core.type.classreading

Class CachingMetadataReaderFactory

    • Field Detail

      • DEFAULT_CACHE_LIMIT

        public static final int DEFAULT_CACHE_LIMIT
        Default maximum number of entries for a local MetadataReader cache: 256.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CachingMetadataReaderFactory

        public CachingMetadataReaderFactory()
        Create a new CachingMetadataReaderFactory for the default class loader, using a local resource cache.
      • CachingMetadataReaderFactory

        public CachingMetadataReaderFactory(@Nullable
                                            java.lang.ClassLoader classLoader)
        Create a new CachingMetadataReaderFactory for the given ClassLoader, using a local resource cache.
        Parameters:
        classLoader - the ClassLoader to use
    • Method Detail

      • setCacheLimit

        public void setCacheLimit(int cacheLimit)
        Specify the maximum number of entries for the MetadataReader cache.

        Default is 256 for a local cache, whereas a shared cache is typically unbounded. This method enforces a local resource cache, even if the ResourceLoader supports a shared resource cache.

      • getCacheLimit

        public int getCacheLimit()
        Return the maximum number of entries for the MetadataReader cache.
      • clearCache

        public void clearCache()
        Clear the local MetadataReader cache, if any, removing all cached class metadata.