Spring Framework

org.springframework.context.annotation
Annotation Type ImportResource


@Retention(value=RUNTIME)
@Target(value=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 AnnotationConfigApplicationContext, but where some XML functionality such as namespaces is still necessary.

By default, arguments to the value() attribute will be processed using an XmlBeanDefinitionReader, i.e. it is assumed that resources are Spring <beans/> XML files. Optionally, the reader() attribute may be supplied, allowing the user to specify a different BeanDefinitionReader implementation, such as PropertiesBeanDefinitionReader.

Since:
3.0
Author:
Chris Beams
See Also:
Configuration, Import

Required Element Summary
 java.lang.String[] value
          Resource paths to import.
 
Optional Element Summary
 java.lang.Class<? extends BeanDefinitionReader> reader
          BeanDefinitionReader implementation to use when processing resources specified by the value() attribute.
 

Element Detail

value

public abstract java.lang.String[] value
Resource paths to import. Resource-loading prefixes such as classpath: and file:, etc may be used.

reader

public abstract java.lang.Class<? extends BeanDefinitionReader> reader
BeanDefinitionReader implementation to use when processing resources specified by the value() attribute.

Default:
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.class

Spring Framework