Annotation Interface Import
@Configuration classes.
Provides functionality equivalent to the <import/> element in Spring XML.
Allows for importing @Configuration classes, ImportSelector,
ImportBeanDefinitionRegistrar, and BeanRegistrar implementations,
as well as regular component classes (analogous to
AnnotationConfigApplicationContext.register(Class...)).
@Bean definitions declared in imported @Configuration classes should be
accessed by using @Autowired
injection. Either the bean itself can be autowired, or the configuration class instance
declaring the bean can be autowired. The latter approach allows for explicit, IDE-friendly
navigation between @Configuration class methods.
May be declared directly at the class level or as a meta-annotation.
@Import annotations declared directly at the class level are processed
after @Import annotations declared as meta-annotations, which allows
directly declared imports to override beans registered via @Import
meta-annotations.
As of Spring Framework 7.0, @Import annotations declared on interfaces
implemented by @Configuration classes are also supported. Locally declared
@Import annotations are processed after @Import annotations on
interfaces, which allows local imports to override beans registered via
@Import annotations inherited from interfaces.
If XML or other non-@Configuration bean definition resources need to be
imported, use the @ImportResource annotation instead.
- Since:
- 3.0
- Author:
- Chris Beams, Juergen Hoeller
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<?>[]@Configuration,ImportSelector,ImportBeanDefinitionRegistrar,BeanRegistrar, or regular component classes to import.
-
Element Details
-
value
Class<?>[] value@Configuration,ImportSelector,ImportBeanDefinitionRegistrar,BeanRegistrar, or regular component classes to import.
-