Annotation Interface 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 Framework 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 XmlBeanDefinitionReader will be used to parse Framework <beans/> XML files. Optionally, the reader() attribute may be declared, allowing the user to choose a custom BeanDefinitionReader implementation.

从以下版本开始:
4.0 2022/3/8 17:39
作者:
Chris Beams, Juergen Hoeller, Sam Brannen, Harry Yang
另请参阅:
  • 元素详细资料

    • value

      @AliasFor("locations") String[] value
      Alias for locations().
      另请参阅:
      默认值:
      {}
    • locations

      @AliasFor("value") 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.

      另请参阅:
      默认值:
      {}
    • reader

      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: resources will be processed with an XmlBeanDefinitionReader.

      另请参阅:
      默认值:
      cn.taketoday.beans.factory.support.BeanDefinitionReader.class