Class ImportCandidates

java.lang.Object
org.springframework.boot.context.annotation.ImportCandidates
All Implemented Interfaces:
Iterable<String>

public final class ImportCandidates extends Object implements Iterable<String>
Contains @Configuration import candidates, usually auto-configurations. The load(Class, ClassLoader) method can be used to discover the import candidates.
Since:
2.7.0
Author:
Moritz Halbritter, Scott Frederick
  • Method Details

    • iterator

      public Iterator<String> iterator()
      Specified by:
      iterator in interface Iterable<String>
    • getCandidates

      public List<String> getCandidates()
      Returns the list of loaded import candidates.
      Returns:
      the list of import candidates
    • load

      public static ImportCandidates load(Class<?> annotation, ClassLoader classLoader)
      Loads the names of import candidates from the classpath. The names of the import candidates are stored in files named META-INF/spring/full-qualified-annotation-name.imports on the classpath. Every line contains the full qualified name of the candidate class. Comments are supported using the # character.
      Parameters:
      annotation - annotation to load
      classLoader - class loader to use for loading
      Returns:
      list of names of annotated classes