@Retention(value=RUNTIME) @Target(value=TYPE) @Documented public @interface ImportResource
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
AnnotationConfigApplicationContext
, but where some XML functionality such
as namespaces is still necessary.
By default, arguments to the value()
attribute will be processed using
GroovyBeanDefinitionReader
if ending in
".groovy"; otherwise, XmlBeanDefinitionReader
will be used to parse Spring <beans/>
XML files. Optionally, the reader()
attribute may be supplied, allowing the user to choose a custom BeanDefinitionReader
implementation.
Configuration
,
Import
Modifier and Type | Required Element and Description |
---|---|
String[] |
value
Resource paths to import.
|
Modifier and Type | Optional Element and Description |
---|---|
Class<? extends BeanDefinitionReader> |
reader
BeanDefinitionReader implementation to use when processing resources
specified by the value() attribute. |
public abstract String[] value
classpath:
and file:
, etc may be used.
Out of the box, ".groovy" files are going to be specifically parsed with
GroovyBeanDefinitionReader
;
others with XmlBeanDefinitionReader
.
public abstract Class<? extends BeanDefinitionReader> reader
BeanDefinitionReader
implementation to use when processing resources
specified by the value()
attribute.
By default, the reader will be adapted to the resource path specified:
".groovy" files are going to be specifically parsed with
GroovyBeanDefinitionReader
;
others with XmlBeanDefinitionReader
.