Example usage for org.springframework.context.index CandidateComponentsIndexLoader loadIndex

List of usage examples for org.springframework.context.index CandidateComponentsIndexLoader loadIndex

Introduction

In this page you can find the example usage for org.springframework.context.index CandidateComponentsIndexLoader loadIndex.

Prototype

@Nullable
public static CandidateComponentsIndex loadIndex(@Nullable ClassLoader classLoader) 

Source Link

Document

Load and instantiate the CandidateComponentsIndex from #COMPONENTS_RESOURCE_LOCATION , using the given class loader.

Usage

From source file:org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.java

/**
 * Set the {@link ResourceLoader} to use for resource locations.
 * This will typically be a {@link ResourcePatternResolver} implementation.
 * <p>Default is a {@code PathMatchingResourcePatternResolver}, also capable of
 * resource pattern resolving through the {@code ResourcePatternResolver} interface.
 * @see org.springframework.core.io.support.ResourcePatternResolver
 * @see org.springframework.core.io.support.PathMatchingResourcePatternResolver
 */// ww w  .  j  a  v a  2 s .  c  o  m
@Override
public void setResourceLoader(@Nullable ResourceLoader resourceLoader) {
    this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
    this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader);
    this.componentsIndex = CandidateComponentsIndexLoader
            .loadIndex(this.resourcePatternResolver.getClassLoader());
}

From source file:org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.java

@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
    this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
    this.componentsIndex = CandidateComponentsIndexLoader.loadIndex(resourceLoader.getClassLoader());
}