Annotation Type ImportResource
@Retention(RUNTIME) @Target(TYPE) @Documented public @interface ImportResource
Indicates one or more resources containing bean definitions to import.Like
@Import
, this annotation provides functionality similar to the<import/>
element in Spring XML. It is typically used when designing@Configuration
classes to be bootstrapped by anAnnotationConfigApplicationContext
, but where some XML functionality such as namespaces is still necessary.By default, arguments to the
value()
attribute will be processed using aGroovyBeanDefinitionReader
if ending in".groovy"
; otherwise, anXmlBeanDefinitionReader
will be used to parse Spring<beans/>
XML files. Optionally, thereader()
attribute may be declared, allowing the user to choose a customBeanDefinitionReader
implementation.- Since:
- 3.0
- Author:
- Chris Beams, Juergen Hoeller, Sam Brannen
- See Also:
Configuration
,Import
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String[]
locations
Resource locations from which to import.Class<? extends BeanDefinitionReader>
reader
BeanDefinitionReader
implementation to use when processing resources specified via thevalue()
attribute.String[]
value
Alias forlocations()
.
Element Detail
value
@AliasFor("locations") String[] value
Alias forlocations()
.- See Also:
locations()
,reader()
- Default:
- {}
reader
Class<? extends BeanDefinitionReader> reader
BeanDefinitionReader
implementation to use when processing resources specified via thevalue()
attribute.By default, the reader will be adapted to the resource path specified:
".groovy"
files will be processed with aGroovyBeanDefinitionReader
; whereas, all other resources will be processed with anXmlBeanDefinitionReader
.- See Also:
value()
- Default:
- org.springframework.beans.factory.support.BeanDefinitionReader.class