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 the
MetadataReaderFactory interface backed by a
ConcurrentReferenceHashMap, caching MetadataReader per Spring
Resource handle (i.e. per ".class" file).- Since:
- 1.4.0
- See Also:
-
CachingMetadataReaderFactory
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newConcurrentReferenceCachingMetadataReaderFactoryinstance for the default class loader.Create a newConcurrentReferenceCachingMetadataReaderFactoryinstance for the given class loader.ConcurrentReferenceCachingMetadataReaderFactory(org.springframework.core.io.ResourceLoader resourceLoader) Create a newConcurrentReferenceCachingMetadataReaderFactoryinstance for the given resource loader. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear the entire MetadataReader cache, removing all cached class metadata.protected org.springframework.core.type.classreading.MetadataReadercreateMetadataReader(org.springframework.core.io.Resource resource) Create the meta-data reader.org.springframework.core.type.classreading.MetadataReadergetMetadataReader(String className) org.springframework.core.type.classreading.MetadataReadergetMetadataReader(org.springframework.core.io.Resource resource) Methods inherited from class org.springframework.core.type.classreading.SimpleMetadataReaderFactory
getResourceLoader
-
Constructor Details
-
ConcurrentReferenceCachingMetadataReaderFactory
public ConcurrentReferenceCachingMetadataReaderFactory()Create a newConcurrentReferenceCachingMetadataReaderFactoryinstance for the default class loader. -
ConcurrentReferenceCachingMetadataReaderFactory
public ConcurrentReferenceCachingMetadataReaderFactory(org.springframework.core.io.ResourceLoader resourceLoader) Create a newConcurrentReferenceCachingMetadataReaderFactoryinstance for the given resource loader.- Parameters:
resourceLoader- the Spring ResourceLoader to use (also determines the ClassLoader to use)
-
ConcurrentReferenceCachingMetadataReaderFactory
Create a newConcurrentReferenceCachingMetadataReaderFactoryinstance for the given class loader.- Parameters:
classLoader- the ClassLoader to use
-
-
Method Details
-
getMetadataReader
public org.springframework.core.type.classreading.MetadataReader getMetadataReader(String className) throws IOException - Specified by:
getMetadataReaderin interfaceorg.springframework.core.type.classreading.MetadataReaderFactory- Overrides:
getMetadataReaderin classorg.springframework.core.type.classreading.SimpleMetadataReaderFactory- Throws:
IOException
-
getMetadataReader
public org.springframework.core.type.classreading.MetadataReader getMetadataReader(org.springframework.core.io.Resource resource) throws IOException - Specified by:
getMetadataReaderin interfaceorg.springframework.core.type.classreading.MetadataReaderFactory- Overrides:
getMetadataReaderin 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.
-