类 CachingMetadataReaderFactory
- java.lang.Object
- org.springframework.core.type.classreading.SimpleMetadataReaderFactory
- org.springframework.core.type.classreading.CachingMetadataReaderFactory
- 所有已实现的接口:
MetadataReaderFactory
public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory
Caching implementation of theMetadataReaderFactory
interface, caching aMetadataReader
instance per SpringResource
handle (i.e. per ".class" file).- 从以下版本开始:
- 2.5
- 作者:
- Juergen Hoeller, Costin Leau
字段概要
字段 修饰符和类型 字段 说明 static int
DEFAULT_CACHE_LIMIT
Default maximum number of entries for the MetadataReader cache: 256
构造器概要
构造器 构造器 说明 CachingMetadataReaderFactory()
Create a new CachingMetadataReaderFactory for the default class loader.CachingMetadataReaderFactory(ClassLoader classLoader)
Create a new CachingMetadataReaderFactory for the given class loader.CachingMetadataReaderFactory(ResourceLoader resourceLoader)
Create a new CachingMetadataReaderFactory for the given resource loader.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
clearCache()
Clear the entire MetadataReader cache, removing all cached class metadata.int
getCacheLimit()
Return the maximum number of entries for the MetadataReader cache.MetadataReader
getMetadataReader(Resource resource)
Obtain a MetadataReader for the given resource.void
setCacheLimit(int cacheLimit)
Specify the maximum number of entries for the MetadataReader cache.从类继承的方法 org.springframework.core.type.classreading.SimpleMetadataReaderFactory
getMetadataReader, getResourceLoader
字段详细资料
DEFAULT_CACHE_LIMIT
public static final int DEFAULT_CACHE_LIMIT
Default maximum number of entries for the MetadataReader cache: 256- 另请参阅:
- 常量字段值
构造器详细资料
CachingMetadataReaderFactory
public CachingMetadataReaderFactory()
Create a new CachingMetadataReaderFactory for the default class loader.
CachingMetadataReaderFactory
public CachingMetadataReaderFactory(ResourceLoader resourceLoader)
Create a new CachingMetadataReaderFactory for the given resource loader.- 参数:
resourceLoader
- the Spring ResourceLoader to use (also determines the ClassLoader to use)
CachingMetadataReaderFactory
public CachingMetadataReaderFactory(ClassLoader classLoader)
Create a new CachingMetadataReaderFactory for the given class loader.- 参数:
classLoader
- the ClassLoader to use
方法详细资料
setCacheLimit
public void setCacheLimit(int cacheLimit)
Specify the maximum number of entries for the MetadataReader cache.Default is 256.
getCacheLimit
public int getCacheLimit()
Return the maximum number of entries for the MetadataReader cache.
getMetadataReader
public MetadataReader getMetadataReader(Resource resource) throws IOException
从接口复制的说明:MetadataReaderFactory
Obtain a MetadataReader for the given resource.- 指定者:
getMetadataReader
在接口中MetadataReaderFactory
- 覆盖:
getMetadataReader
在类中SimpleMetadataReaderFactory
- 参数:
resource
- the resource (pointing to a ".class" file)- 返回:
- a holder for the ClassReader instance (never
null
) - 抛出:
IOException
- in case of I/O failure
clearCache
public void clearCache()
Clear the entire MetadataReader cache, removing all cached class metadata.