DeferredImportSelector class abstract interface

An ImportSelector that runs after every other module and component has been loaded.

Because it runs last, the modules it returns can back off when the application already declared a bean (@ConditionalOnMissingBean). This is how defaults are provided that an application can replace; Spring Boot imports its auto-configurations this way. Deferred selectors run in Ordered / @Order order, registration order otherwise; a deferred selector imported by a deferred selector runs right away.

// A default clock module, loaded after the application's beans.
class DefaultsSelector implements DeferredImportSelector, Ordered {
  const DefaultsSelector();

  @override
  int get order => Ordered.lowestPrecedence;

  @override
  List<BeanModule> selectImports() => [defaultClockModule];
}

Spring (Java):

class DefaultsSelector implements DeferredImportSelector, Ordered {
  public String[] selectImports(AnnotationMetadata metadata) {
    return new String[] {DefaultClockConfig.class.getName()};
  }
}
Implemented types

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
selectImports() → List<BeanModule>
Returns the modules to load; an empty list adds nothing.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited