@Import annotation can be used for importing bean definitions from other @Configuration classes.
@Import annotation can also be configured with an ImportSelector implementation to select @Configuration classes programmatically, based on some selection criteria.
Select and return the names of which class(es) should be imported based on the AnnotationMetadata of the importing @Configuration class.
2
Return a predicate for excluding classes from the import candidates, to be transitively applied to all classes found through this selector's imports.
(Since 5.2.4)
ImportSelector use cases
ImportSelector can be used for dynamic configuration selection rather than static @Profile based selection.
Spring framework itself uses ImportSelector at many places to ease the configuration burden on the client side, for example @EnableAsync, @EnableScheduling etc.
In the next tutorials we will see how to use ImportSelector