Skip to content

Ignore duplicated import files or property-placeholder files [SPR-9526] #14160

@spring-projects-issues

Description

@spring-projects-issues

Jay Blanton opened SPR-9526 and commented

We have a web service architecture where any service (API - Int/Impl) could be exposed as a web service. Because of this we have very granular deployment artifacts where each service builds down to a JAR. That way we can pick and chose what JARs create a web service implementation (into a WAR). Because of this we have duplicated property file imports and context file imports, but we know it is going to happen because each individual service needs to be buildable, runnable, and testable...and then it might be composed into a larger service.

The example from this thread:
http://forum.springsource.org/showthread.php?36482-Preventing-Spring-Context-to-be-loaded-more-than-once&highlight=duplicate+context+files

Is a perfect example:
http://piotrga.wordpress.com/2007/03/21/preventing-spring-context-to-be-loaded-more-than-once/

We might Service B (which is it's own WAR), Service C (which is it's own WAR), and also a Service A (which has dependencies on Service B/C) and therefore pulls in duplicate import statements for the same context file.

The following is a post that I made, without a response, describing the same issue with the property-placeholder.
http://stackoverflow.com/questions/8949174/does-spring-ignore-duplicate-property-placeholder-files

Since we are aware of the duplicates, we don't want to have exceptions thrown when encountering duplicate bean ids. We don't receive these errors/issues, but we can see that the duplicate files are loaded and override each other.

It would be beneficial if both the import and property-placeholder had the capability to ignore-duplicate-files, or via a property in a custom ApplicationContext (like we extend XmlWebApplicationContext) which would allow the ignore-duplicate-files for properties or bean context files.


Affects: 3.0.5

Reference URL: http://forum.springsource.org/showthread.php?36482-Preventing-Spring-Context-to-be-loaded-more-than-once&highlight=duplicate+context+files

Issue Links:

10 votes, 7 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: coreIssues in core modules (aop, beans, core, context, expression)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions