diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Import.java b/spring-context/src/main/java/org/springframework/context/annotation/Import.java index c1275801fc0..60ff80dcae2 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Import.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Import.java @@ -29,9 +29,11 @@ import org.springframework.beans.factory.BeanRegistrar; * {@link Configuration @Configuration} classes. * *
Provides functionality equivalent to the {@code
Allows for importing {@code @Configuration} classes, {@link ImportSelector}, + * {@link ImportBeanDefinitionRegistrar}, and {@link BeanRegistrar} implementations, + * as well as regular component classes (analogous to + * {@link AnnotationConfigApplicationContext#register}). * *
{@code @Bean} definitions declared in imported {@code @Configuration} classes should be * accessed by using {@link org.springframework.beans.factory.annotation.Autowired @Autowired} @@ -39,7 +41,11 @@ import org.springframework.beans.factory.BeanRegistrar; * declaring the bean can be autowired. The latter approach allows for explicit, IDE-friendly * navigation between {@code @Configuration} class methods. * - *
May be declared at the class level or as a meta-annotation. + *
May be declared directly at the class level or as a meta-annotation. + * {@code @Import} annotations declared directly at the class level are processed + * after {@code @Import} annotations declared as meta-annotations, which allows + * directly declared imports to override beans registered via {@code @Import} + * meta-annotations. * *
If XML or other non-{@code @Configuration} bean definition resources need to be * imported, use the {@link ImportResource @ImportResource} annotation instead. @@ -59,7 +65,7 @@ public @interface Import { /** * {@link Configuration @Configuration}, {@link ImportSelector}, - * {@link ImportBeanDefinitionRegistrar}, {@link BeanRegistrar} or regular + * {@link ImportBeanDefinitionRegistrar}, {@link BeanRegistrar}, or regular * component classes to import. */ Class>[] value();