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 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.

    Since:
    3.0
    Author:
    Chris Beams, Juergen Hoeller, Sam Brannen
    See Also:
    Configuration, Import
      • locations

        @AliasFor(value="value")
        public abstract java.lang.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.

        Since:
        4.2
        See Also:
        value(), reader()
        Default:
        {}