注释类型 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@Configurationclasses 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 aGroovyBeanDefinitionReaderif ending in".groovy"; otherwise, anXmlBeanDefinitionReaderwill be used to parse Spring<beans/>XML files. Optionally, thereader()attribute may be declared, allowing the user to choose a customBeanDefinitionReaderimplementation.- 从以下版本开始:
- 3.0
- 作者:
- Chris Beams, Juergen Hoeller, Sam Brannen
- 另请参阅:
Configuration,Import
可选元素概要
可选元素 修饰符和类型 可选元素 说明 String[]locationsResource locations from which to import.Class<? extends BeanDefinitionReader>readerBeanDefinitionReaderimplementation to use when processing resources specified via thevalue()attribute.String[]valueAlias forlocations().
元素详细资料
value
@AliasFor("locations") String[] value
Alias forlocations().- 另请参阅:
locations(),reader()
- 默认值:
- {}
reader
Class<? extends BeanDefinitionReader> reader
BeanDefinitionReaderimplementation 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.- 另请参阅:
value()
- 默认值:
- org.springframework.beans.factory.support.BeanDefinitionReader.class