Class ConcurrentReferenceCachingMetadataReaderFactory
- java.lang.Object
- org.springframework.core.type.classreading.SimpleMetadataReaderFactory
- org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory
- All Implemented Interfaces:
org.springframework.core.type.classreading.MetadataReaderFactory
public class ConcurrentReferenceCachingMetadataReaderFactory extends org.springframework.core.type.classreading.SimpleMetadataReaderFactory
Caching implementation of theMetadataReaderFactory
interface backed by aConcurrentReferenceHashMap
, cachingMetadataReader
per SpringResource
handle (i.e. per ".class" file).- Since:
- 1.4.0
- See Also:
CachingMetadataReaderFactory
Constructor Summary
Constructors Constructor Description ConcurrentReferenceCachingMetadataReaderFactory()
Create a newConcurrentReferenceCachingMetadataReaderFactory
instance for the default class loader.ConcurrentReferenceCachingMetadataReaderFactory(ClassLoader classLoader)
Create a newConcurrentReferenceCachingMetadataReaderFactory
instance for the given class loader.ConcurrentReferenceCachingMetadataReaderFactory(org.springframework.core.io.ResourceLoader resourceLoader)
Create a newConcurrentReferenceCachingMetadataReaderFactory
instance for the given resource loader.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
Clear the entire MetadataReader cache, removing all cached class metadata.protected org.springframework.core.type.classreading.MetadataReader
createMetadataReader(org.springframework.core.io.Resource resource)
Create the meta-data reader.org.springframework.core.type.classreading.MetadataReader
getMetadataReader(org.springframework.core.io.Resource resource)
Constructor Detail
ConcurrentReferenceCachingMetadataReaderFactory
public ConcurrentReferenceCachingMetadataReaderFactory()
Create a newConcurrentReferenceCachingMetadataReaderFactory
instance for the default class loader.
ConcurrentReferenceCachingMetadataReaderFactory
public ConcurrentReferenceCachingMetadataReaderFactory(org.springframework.core.io.ResourceLoader resourceLoader)
Create a newConcurrentReferenceCachingMetadataReaderFactory
instance for the given resource loader.- Parameters:
resourceLoader
- the Spring ResourceLoader to use (also determines the ClassLoader to use)
ConcurrentReferenceCachingMetadataReaderFactory
public ConcurrentReferenceCachingMetadataReaderFactory(ClassLoader classLoader)
Create a newConcurrentReferenceCachingMetadataReaderFactory
instance for the given class loader.- Parameters:
classLoader
- the ClassLoader to use
Method Detail
getMetadataReader
public org.springframework.core.type.classreading.MetadataReader getMetadataReader(org.springframework.core.io.Resource resource) throws IOException
- Specified by:
getMetadataReader
in interfaceorg.springframework.core.type.classreading.MetadataReaderFactory
- Overrides:
getMetadataReader
in classorg.springframework.core.type.classreading.SimpleMetadataReaderFactory
- Throws:
IOException
createMetadataReader
protected org.springframework.core.type.classreading.MetadataReader createMetadataReader(org.springframework.core.io.Resource resource) throws IOException
Create the meta-data reader.- Parameters:
resource
- the source resource.- Returns:
- the meta-data reader
- Throws:
IOException
- on error
clearCache
public void clearCache()
Clear the entire MetadataReader cache, removing all cached class metadata.