Top Description Methods
org.springframework.context.annotation

public @Interface ImportResource

extends Annotation
Annotations
@Retention:RUNTIME
@Target:TYPE
@Documented
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.beans.factory.support.BeanDefinitionReader, org.springframework.core.annotation.AliasFor

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 an AnnotationConfigApplicationContext, but where some XML functionality such as namespaces is still necessary.

By default, arguments to the value attribute will be processed using a GroovyBeanDefinitionReader if ending in ".groovy"; otherwise, an XmlBeanDefinitionReader will be used to parse Spring <beans/> XML files. Optionally, the reader attribute may be declared, allowing the user to choose a custom BeanDefinitionReader implementation.

Authors
Chris Beams, Juergen Hoeller, Sam Brannen
Since
3.0
See Also
Configuration, Import

Method Summary

Modifier and TypeMethod and Description
public String[]
locations()

Resource locations from which to import.

public Class<? extends BeanDefinitionReader>
reader()

BeanDefinitionReader implementation to use when processing resources specified via the value attribute.

public String[]
value()

Alias for locations.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

locationsback to summary
public String[] locations()

Resource locations from which to import.

Supports resource-loading prefixes such as classpath:, file:, etc.

Consult the Javadoc for reader for details on how resources will be processed.

Annotations
@AliasFor:value
Since
4.2
See Also
value, reader
readerback to summary
public Class<? extends BeanDefinitionReader> reader()

BeanDefinitionReader implementation to use when processing resources specified via the value attribute.

By default, the reader will be adapted to the resource path specified: ".groovy" files will be processed with a GroovyBeanDefinitionReader; whereas, all other resources will be processed with an XmlBeanDefinitionReader.

See Also
value
valueback to summary
public String[] value()

Alias for locations.

Annotations
@AliasFor:locations
See Also
locations, reader