Annotation Type Import
@Target(TYPE) @Retention(RUNTIME) @Documented public @interface Import
Indicates one or more component classes to import — typically@Configurationclasses.Provides functionality equivalent to the
<import/>element in Spring XML. Allows for importing@Configurationclasses,ImportSelectorandImportBeanDefinitionRegistrarimplementations, as well as regular component classes (as of 4.2; analogous toAnnotationConfigApplicationContext.register(java.lang.Class<?>...)).@Beandefinitions declared in imported@Configurationclasses should be accessed by using@Autowiredinjection. 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@Configurationclass methods.May be declared at the class level or as a meta-annotation.
If XML or other non-
@Configurationbean definition resources need to be imported, use the@ImportResourceannotation instead.- Since:
- 3.0
- Author:
- Chris Beams, Juergen Hoeller
- See Also:
Configuration,ImportSelector,ImportBeanDefinitionRegistrar,ImportResource
Required Element Summary
Required Elements Modifier and Type Required Element Description Class<?>[]value@Configuration,ImportSelector,ImportBeanDefinitionRegistrar, or regular component classes to import.
Element Detail
value
Class<?>[] value
@Configuration,ImportSelector,ImportBeanDefinitionRegistrar, or regular component classes to import.