-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
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
Issue Links:
- Multiple bean instances are created when no id is specified [SPR-11757] #16379 Multiple bean instances are created when no id is specified ("is duplicated by")
- Load files in
<import resource=... />only once [SPR-1142] #5845 Load files in only once
10 votes, 7 watchers