<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=tmaris" rel="nofollow">FoX</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4111?redirect=false" rel="nofollow">SPR-4111</a></strong> and commented</p>
<p dir="auto">All ApplicationListeners will be instantiated when the ApplicationContext registers its listeners.<br>
The consequence of this operation for our application is that nearly all beans are initialized at startup time eventhough lazy-init is set to true on all contexts.<br>
This is especially annoying in our integration tests, because the initialization takes a lot of time.</p>
<p dir="auto">Isn't there a possibility to register these listeners as a proxy, allowing lazy initialization of these listeners until an application event occurs?<br>
Or, maybe it would also be a valid solution to not put the listeners themselves in the map, but the bean names (not that nice, as it would break observer/observable pattern)</p>
<p dir="auto">It seems that the getBeansOfType() method in the DefaultListableBeanFactory doesn't take the allowEagerInit boolean into account when retrieving the beans:</p>
<p dir="auto">public Map getBeansOfType(Class type, boolean includePrototypes, boolean allowEagerInit) throws BeansException {<br>
String[] beanNames = getBeanNamesForType(type, includePrototypes, allowEagerInit);<br>
Map result = CollectionFactory.createLinkedMapIfPossible(beanNames.length);<br>
for (int i = 0; i &lt; beanNames.length; i++) {<br>
String beanName = beanNames[i];<br>
try {<br>
// -----------------------&gt; getBean(beanName) will always instantiate the bean, eager init or not?<br>
result.put(beanName, getBean(beanName));<br>
}<br>
...<br>
}<br>
...<br>
}</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.7</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="398082267" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/8733" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/8733/hovercard" href="https://github.com/spring-projects/spring-framework/issues/8733">#8733</a> ApplicationListener beans eagerly instantiated even when marked as lazy-init (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=senoctar" rel="nofollow">Patras Vlad Sebastian</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-7984?redirect=false" rel="nofollow">SPR-7984</a></strong> and commented</p>
<p dir="auto">Allow mapping the same method to multiple URL's that differ in respect to what path variables they use.<br>
For example we do not want to transfer the id of the logged in user in the URL for security reasons and simplicity, but there are pages that can either show data for the logged in user or an other user, like a profile page.<br>
I would like to be able to map a method like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@RequestMapping(value = {&quot;/profile&quot;, &quot;/profile/{userId}&quot;})
public String showProfile(@PathVariable(&quot;userId&quot;) Integer userId) {
  if (userId == null) {
    userId = &lt;get id of logged in user from session&gt;;
  }
  //do stuff
}"><pre class="notranslate"><code class="notranslate">@RequestMapping(value = {"/profile", "/profile/{userId}"})
public String showProfile(@PathVariable("userId") Integer userId) {
  if (userId == null) {
    userId = &lt;get id of logged in user from session&gt;;
  }
  //do stuff
}
</code></pre></div>
<p dir="auto">The first path of the request mapping to does not have a "userId" path variable, and it would be nice if userId (the method parameter) would be null in this case, rather than throwing IllegalStateException.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.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="398112689" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/13049" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/13049/hovercard" href="https://github.com/spring-projects/spring-framework/issues/13049">#13049</a> A <code class="notranslate">@PathVariable</code> provided in the method parameter, but not in the <code class="notranslate">@RequestMapping</code>, will throw an IllegalStateException. (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto">1 votes, 4 watchers</p>