Class CandidateComponentsIndexLoader
- java.lang.Object
- org.springframework.context.index.CandidateComponentsIndexLoader
public final class CandidateComponentsIndexLoader extends Object
Candidate components index loading mechanism for internal use within the framework.- Since:
- 5.0
- Author:
- Stephane Nicoll
Field Summary
Fields Modifier and Type Field Description static String
COMPONENTS_RESOURCE_LOCATION
The location to look for components.static String
IGNORE_INDEX
System property that instructs Spring to ignore the index, i.e.
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CandidateComponentsIndex
loadIndex(ClassLoader classLoader)
Load and instantiate theCandidateComponentsIndex
from "META-INF/spring.components", using the given class loader.
Field Detail
COMPONENTS_RESOURCE_LOCATION
public static final String COMPONENTS_RESOURCE_LOCATION
The location to look for components.Can be present in multiple JAR files.
- See Also:
- Constant Field Values
IGNORE_INDEX
public static final String IGNORE_INDEX
System property that instructs Spring to ignore the index, i.e. to always returnnull
fromloadIndex(ClassLoader)
.The default is "false", allowing for regular use of the index. Switching this flag to
true
fulfills a corner case scenario when an index is partially available for some libraries (or use cases) but couldn't be built for the whole application. In this case, the application context fallbacks to a regular classpath arrangement (i.e. as no index was present at all).- See Also:
- Constant Field Values
Method Detail
loadIndex
@Nullable public static CandidateComponentsIndex loadIndex(@Nullable ClassLoader classLoader)
Load and instantiate theCandidateComponentsIndex
from "META-INF/spring.components", using the given class loader. If no index is available, returnnull
.- Parameters:
classLoader
- the ClassLoader to use for loading (can benull
to use the default)- Returns:
- the index to use or
null
if no index was found - Throws:
IllegalArgumentException
- if any module index cannot be loaded or if an error occurs while creatingCandidateComponentsIndex