Top Description Methods
org.springframework.context.annotation

public Interface ImportSelector

Known Direct Subinterfaces
org.springframework.context.annotation.DeferredImportSelector
Known Direct Implementers
org.springframework.context.annotation.AdviceModeImportSelector
Imports
java.util.function.Predicate, org.springframework.core.type.AnnotationMetadata, org.springframework.lang.Nullable

Interface to be implemented by types that determine which @Configuration class(es) should be imported based on a given selection criteria, usually one or more annotation attributes.

An ImportSelector may implement any of the following Aware interfaces, and their respective methods will be called prior to selectImports:

Alternatively, the class may provide a single constructor with one or more of the following supported parameter types:

ImportSelector implementations are usually processed in the same way as regular @Import annotations, however, it is also possible to defer selection of imports until all @Configuration classes have been processed (see DeferredImportSelector for details).

Authors
Chris Beams, Juergen Hoeller
Since
3.1
See Also
DeferredImportSelector, Import, ImportBeanDefinitionRegistrar, Configuration

Method Summary

Modifier and TypeMethod and Description
public default Predicate<String>

Returns:

the filter predicate for fully-qualified candidate class names of transitively imported configuration classes, or null if none
getExclusionFilter
()

Return a predicate for excluding classes from the import candidates, to be transitively applied to all classes found through this selector's imports.

public String[]

Returns:

the class names, or an empty array if none
selectImports
(AnnotationMetadata importingClassMetadata)

Select and return the names of which class(es) should be imported based on the AnnotationMetadata of the importing @Configuration class.

Method Detail

getExclusionFilterback to summary
public default Predicate<String> getExclusionFilter()

Return a predicate for excluding classes from the import candidates, to be transitively applied to all classes found through this selector's imports.

If this predicate returns true for a given fully-qualified class name, said class will not be considered as an imported configuration class, bypassing class file loading as well as metadata introspection.

Returns:Predicate<String>

the filter predicate for fully-qualified candidate class names of transitively imported configuration classes, or null if none

Annotations
@Nullable
Since
5.2.4
selectImportsback to summary
public String[] selectImports(AnnotationMetadata importingClassMetadata)

Select and return the names of which class(es) should be imported based on the AnnotationMetadata of the importing @Configuration class.

Returns:String[]

the class names, or an empty array if none