<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=avatah" rel="nofollow">Wojciech Durczyński</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-5156?redirect=false" rel="nofollow">SPR-5156</a></strong> and commented</p>
<p dir="auto">In OSGI <code class="notranslate">@Configurable</code> mechanism works well only when used in one bundle.<br>
If there is &lt;context:spring-configured /&gt; in application contexts of more then one bundle, the AnnotationBeanConfigurerAspect (single instance) is injected with two different BeanConfigurerSupport objects in non deterministic order.<br>
Bundle whose BeanFactory is injected to aspect most recently works well - others don't work at all.</p>
<p dir="auto">Is there any work around for this problem?</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.5</p>
<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="398092675" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10074" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10074/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10074">#10074</a> AnnotationBeanConfigurerAspect is created as a singleton and cannot be shared across multiple contexts (<em><strong>"duplicates"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398092675" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10074" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10074/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10074">#10074</a> AnnotationBeanConfigurerAspect is created as a singleton and cannot be shared across multiple contexts (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto">15 votes, 20 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=speedskater" rel="nofollow">Robert Binna</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9296?redirect=false" rel="nofollow">SPR-9296</a></strong> and commented</p>
<p dir="auto">In version 3.1.1 of the springframework, the creation of the application context and the lookup of beans by type, in particular the lookup of prototype beans is extremely slow (factor 10).<br>
The same creation and lookup process in spring 3.0.6 was significantly faster.<br>
The definition of the application context is done through java based bean configuration.</p>
<p dir="auto">Therefore we created a sample programm which can be used to reproduce the problem (program together with a gradle build file is attached, <code class="notranslate">gradle run</code> executes the test).<br>
This application uses javasssist to create 100 bean classes. Each bean class has 5 autowired bean properties. The bean properties are generated, such that no cyclic dependencies occur. Finally a configuration class containing the generated beans is constructed and loaded. All beans are created as singletons except one bean which has been created as prototype scope.<br>
After the application context is loaded a single bean is looked up from the application context 100 times. In the first case this is done with a bean of scope singleton. In the second case this is done with a bean of scope prototype.<br>
The same tests was issued on spring 3.1.1 and spring 3.0.6</p>
<p dir="auto">The results are as follows:</p>
<p dir="auto">==== Spring 3.1.1 ====</p>
<p dir="auto">SingletonBean:</p>
<hr>
<p dir="auto">StopWatch 'SpringPerformanceTest': running time (millis) = 17004; [settingUpApplicationContext] took 15177 = 89%; [retrievingBeans] took 1827 = 11%</p>
<p dir="auto">PrototypeBean:</p>
<hr>
<p dir="auto">StopWatch 'SpringPerformanceTest': running time (millis) = 24400; [settingUpApplicationContext] took 13126 = 54%; [retrievingBeans] took 11274 = 46%</p>
<p dir="auto">==== Spring 3.0.6 ====</p>
<p dir="auto">SingletonBean:</p>
<hr>
<p dir="auto">StopWatch 'SpringPerformanceTest': running time (millis) = 3110; [settingUpApplicationContext] took 2654 = 85%; [retrievingBeans] took 456 = 15%</p>
<p dir="auto">PrototypeBean:</p>
<hr>
<p dir="auto">StopWatch 'SpringPerformanceTest': running time (millis) = 3163; [settingUpApplicationContext] took 1790 = 57%; [retrievingBeans] took 1373 = 43%</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1.1</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/19558/benchmark.zip" rel="nofollow">benchmark.zip</a> (<em>3.84 kB</em>)</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="398103107" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11536" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11536/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11536">#11536</a> Cache by-type lookups in DefaultListableBeanFactory (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto">1 votes, 3 watchers</p>