Skip to content

Support relative and by-convention use of @ImportResource [SPR-6310] #10976

Closed

Description

@spring-projects-issues

Chris Beams opened SPR-6310 and commented

Much like Spring's TestContext framework and its @ContextConfiguration annotation, processing @Configuration classes should support relative paths and loading resources by convention when using @ImportXml:

  1. Relative paths:
package com.biz.app;
@Configuration
@ImportResource("Foo.xml")
public class AppConfig { ... }

It is assumed that Foo.xml resides in com.biz.app, the same package in which AppConfig is declared.

  1. Import by convention:
package com.biz.app;
@Configuration
@ImportResource
public class AppConfig { ... }

It is assumed that classpath:/com/biz/app/AppConfig-context.xml exists.

See testImportXmlWithRelativePath() and testImportXmlByConvention(), which are both currently @Ignore'd in org.springframework.context.annotation.configuration.ImportXmlTests. See also TODO in ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromXml()


Issue Links:

Referenced from: commits ae11387

1 votes, 3 watchers

Activity

  1. added
    status: declined
    type: enhancement
    in: core
    on Jan 11, 2019
  2. added a commit that references this issue on May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: corestatus: declinedtype: enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions