<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=benrowlands" rel="nofollow">Ben Rowlands</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4345?redirect=false" rel="nofollow">SPR-4345</a></strong> and commented</p>
<p dir="auto">The rest of the bean creation code guards against a null bean instance (we are using a null bean as a placeholder to delay creation of heavy weight objects when all we want is to create a skeleton layout of our application) .</p>
<p dir="auto">NPE occurs when request the wrapped instance from the BeanWrapper (which may be null) in populateBean() :</p>
<p dir="auto">...<br>
if (!ibp.postProcessAfterInstantiation(bw.getWrappedInstance(), beanName))<br>
...</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5 final</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="398084830" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/9045" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/9045/hovercard" href="https://github.com/spring-projects/spring-framework/issues/9045">#9045</a> Autowiring failed when one of the bean contains factory-method (<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="398085065" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/9075" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/9075/hovercard" href="https://github.com/spring-projects/spring-framework/issues/9075">#9075</a> CLONE -Autowiring failed when one of the bean contains factory-method (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=rauar" rel="nofollow">Alex Rau</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6524?redirect=false" rel="nofollow">SPR-6524</a></strong> and commented</p>
<p dir="auto">the mvc:annotation-driven feature breaks or at least does not conform to the implemented strategy in MVC that there is an implicit DefaultAnnotationHandlerMapping (D1) which can be replaced with custom parameterized versions (D2) of handler mappings.</p>
<p dir="auto">As soon as someone wants to use the above short-cut "mvc:annotation-driven" there will be a DefaultAnnotationHandlerMapping (D3) which a) cannot be replaced with a custom version (D2) anymore and b) replaces the implicit one (D1). Even worse - developers declaring (D3) assuming they would override the implicit one (D1) will end up with two instances of DefaultAnnotationHandlerMapping (D2 and D3) resulting in duplicate registration of annotated controllers (component scan) and custom parameterization which will be without any effect as D2 seems to win over D3.</p>
<p dir="auto">I think at least a dedicated property for the above declaration should be defined which allows passing in a custom DefaultAnnotationHandlerMapping along with the declaration (+ some clarifying documentation about this wouldn't be too bad).</p>
<p dir="auto">Steps to reproduce:</p>
<ol dir="auto">
<li>
<p dir="auto">declare in a web application context (e.g. using Spring's DispatcherServlet):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;mvc:annotation-driven/&gt;"><pre class="notranslate"><code class="notranslate">&lt;mvc:annotation-driven/&gt;
</code></pre></div>
<p dir="auto">&lt;bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /&gt;</p>
<p dir="auto">&lt;context:component-scan base-package="org.retroduction" use-default-filters="false"&gt;<br>
&lt;context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/&gt;<br>
&lt;/context:component-scan&gt;</p>
</li>
<li>
<p dir="auto">declare a java controller using <code class="notranslate">@Controller</code></p>
</li>
<li>
<p dir="auto">start container with logging enabled and check logs for duplicate registration of the controller</p>
</li>
</ol>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 RC2, 3.0 RC3</p>
<p dir="auto"><strong>Reference URL:</strong> <a href="http://forum.springsource.org/showthread.php?p=272494" rel="nofollow">http://forum.springsource.org/showthread.php?p=272494</a></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="398099623" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11070" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11070/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11070">#11070</a> Document new mvc namespace (<em><strong>"is superseded by"</strong></em>)</li>
</ul>