<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=eberhardwolff" rel="nofollow">Eberhard Wolff</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6870?redirect=false" rel="nofollow">SPR-6870</a></strong> and commented</p>
<p dir="auto">The Autowiring algorithms tries to work out the dependencies by building up the Beans. If this fails, a BeanCreationException is thrown, caught and then a different way to handle the dependencies is tried. In some situations this results in slow performance and it is probably also not the nicest programming style.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.6</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/18035/perf305MainPatch.html" rel="nofollow">perf305MainPatch.html</a> (<em>110.13 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/18034/perf305stock.html" rel="nofollow">perf305stock.html</a> (<em>120.62 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/18036/perfDiffStockVsPatch1.html" rel="nofollow">perfDiffStockVsPatch1.html</a> (<em>154.63 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/18033/SPR6870.patch" rel="nofollow">SPR6870.patch</a> (<em>2.63 kB</em>)</li>
</ul>
<p dir="auto"><strong>Sub-tasks:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398150822" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14083" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14083/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14083">#14083</a> Backport "Cache by-type lookups in DefaultListableBeanFactory"</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398118456" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/13934" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/13934/hovercard" href="https://github.com/spring-projects/spring-framework/issues/13934">#13934</a> Major Performance Problem in ApplicationContext Creation and Prototype Bean Lookup by Type (<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="398110075" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12604" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12604/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12604">#12604</a> Improve performance of DefaultSingletonBeanRegistry.getSingletonNames(..) for high-concurrent-load applications (<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="398111007" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12750" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12750/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12750">#12750</a> Improve performance of bean lookup by type for DefaultListableBeanFactory (<em><strong>"is duplicated by"</strong></em>)</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/841d9533dbdcd254d3d528430e6448732732c152/hovercard" href="https://github.com/spring-projects/spring-framework/commit/841d9533dbdcd254d3d528430e6448732732c152"><tt>841d953</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/0d18deb6a47be8d80aeee7542b4e6a231e3a97b3/hovercard" href="https://github.com/spring-projects/spring-framework/commit/0d18deb6a47be8d80aeee7542b4e6a231e3a97b3"><tt>0d18deb</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/db1cb13448dcdc11c6ebd087d0a436614d541d90/hovercard" href="https://github.com/spring-projects/spring-framework/commit/db1cb13448dcdc11c6ebd087d0a436614d541d90"><tt>db1cb13</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/f75c01d191e0b08334d067d7eae58e1faa7afdc9/hovercard" href="https://github.com/spring-projects/spring-framework/commit/f75c01d191e0b08334d067d7eae58e1faa7afdc9"><tt>f75c01d</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/4c7a1c0a5403b35dd812dae1f2a753538928bb32/hovercard" href="https://github.com/spring-projects/spring-framework/commit/4c7a1c0a5403b35dd812dae1f2a753538928bb32"><tt>4c7a1c0</tt></a></p>
<p dir="auto">45 votes, 45 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=kierone" rel="nofollow">Kieron Edwards</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-5933?redirect=false" rel="nofollow">SPR-5933</a></strong> and commented</p>
<p dir="auto">This is the exception when trying to load org.apache.xml.dtm.ref.DTMManagerDefault from ShadowingClassLoader in a multithreaded environment (I have assigned intensive parsing tasks to multiple threads). I can get around this by subclassing AbstractJpaTests :-</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Override
protected void customizeResourceOverridingShadowingClassLoader(ClassLoader shadowingClassLoader){
	((ShadowingClassLoader)shadowingClassLoader).excludePackage(&quot;org.apache.xml.&quot;);
}"><pre class="notranslate"><code class="notranslate">@Override
protected void customizeResourceOverridingShadowingClassLoader(ClassLoader shadowingClassLoader){
	((ShadowingClassLoader)shadowingClassLoader).excludePackage("org.apache.xml.");
}
</code></pre></div>
<p dir="auto">but Im wondering if this multi-threaded problem could affect the production environment. Any thoughts, nudges in the right direction would be appreciated, stack trace below ...</p>
<p dir="auto">java.lang.LinkageError: loader (instance of  org/springframework/test/jpa/OrmXmlOverridingShadowingClassLoader): attempted  duplicate class definition for name: "org/apache/xml/dtm/ref/DTMManagerDefault"<br>
at java.lang.ClassLoader.defineClass1(Native Method)<br>
at java.lang.ClassLoader.defineClass(ClassLoader.java:703)<br>
at java.lang.ClassLoader.defineClass(ClassLoader.java:548)<br>
at org.springframework.instrument.classloading.ShadowingClassLoader.doLoadClass(ShadowingClassLoader.java:151)<br>
at org.springframework.instrument.classloading.ShadowingClassLoader.loadClass(ShadowingClassLoader.java:102)<br>
at org.apache.xml.dtm.ObjectFactory.findProviderClass(ObjectFactory.java:508)<br>
at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.java:219)<br>
at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:133)<br>
at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:103)<br>
at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:137)<br>
at org.apache.xpath.XPathContext.&lt;init&gt;(XPathContext.java:102)<br>
at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:115)</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.6</p>