<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=sqrrrl" rel="nofollow">Steven Bazyl</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-765?redirect=false" rel="nofollow">SPR-765</a></strong> and commented</p>
<p dir="auto">I haven't yet narrowed down a simple test case, but we recently saw a problem where we're trying to load multiple spring bean definition files from jars packaged in an ear using a well-known filename approach (e.g. classpath*:beans.xml)</p>
<p dir="auto">What we're seeing is that the same UrlResource is being returned multiple times.  While its harmless in that it only results in beans redefining themselves with the same definition, it does cause a lot of noise in the logs and increases our start up time just slightly.  We've also seen cases where the same URL is returned albeit with slightly different path represenatations ( /beans.xml vs. /./beans.xml)</p>
<p dir="auto">It would be nice if findAllClassPathResources() ensured each unique resource is returned once and only once.  One simple change is just changing from List to Set to hold the resources while enumerating.  This fixes the first part (same path multiple times) and fixing the second part should just be a matter of normalizing the URL.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.1.5</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=carrotsalad" rel="nofollow">David Fogel</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-5932?redirect=false" rel="nofollow">SPR-5932</a></strong> and commented</p>
<p dir="auto">What we are seeing is that when we use <code class="notranslate">@Configuration-annotated</code> configuration classes to define our beans, that our singleton beans are instead treated as prototype beans. This means that we get new instances of our singletons for each time they are referenced (!!!).</p>
<p dir="auto">I have created sample code which demonstrates this broken behavior.</p>
<p dir="auto">This code, when run as a regular spring-ified java application, (NOT OSGi), works as expected (only ONE instance of Foo and Bar are created).</p>
<p dir="auto">BUT, when the identical code is run via Spring DM, THREE different instances of Bar are created!</p>
<p dir="auto">Note: I used a FileSystemXmlApplicationContext to load this when running as a normal java application, and put the config.xml file inside a /META-INF/spring folder when running in Spring dm.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 M3</p>
<p dir="auto"><strong>Reference URL:</strong> <a href="http://forum.springsource.org/showthread.php?t=74458" rel="nofollow">http://forum.springsource.org/showthread.php?t=74458</a></p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/15531/spring-dm-javaconfig-bug.zip" rel="nofollow">spring-dm-javaconfig-bug.zip</a> (<em>2.96 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/browse/SJC-89" rel="nofollow">SJC-89</a> Ensure OSGi / Spring Dynamic Modules compatibility (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398118296" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/13912" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/13912/hovercard" href="https://github.com/spring-projects/spring-framework/issues/13912">#13912</a> Java config FactoryBean proxy causes class loader leak</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398157403" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14941" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14941/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14941">#14941</a> Concurrent creation of the same Configuration class in different contexts is not thread-safe</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/9e0d87c5189cf07f0122b5edfd91321fdf0de013/hovercard" href="https://github.com/spring-projects/spring-framework/commit/9e0d87c5189cf07f0122b5edfd91321fdf0de013"><tt>9e0d87c</tt></a></p>