<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=greenwayb" rel="nofollow">Ben Greenway</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4704?redirect=false" rel="nofollow">SPR-4704</a></strong> and commented</p>
<p dir="auto">An exception occurred when using the factory-method call.</p>
<p dir="auto">2008-04-15 16:54:18,854 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed<br>
java.lang.NullPointerException<br>
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.getCacheKey(AbstractAutoProxyCreator.java:322)<br>
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.predictBeanType(AbstractAutoProxyCreator.java:245)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:531)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1174)<br>
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)<br>
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:303)<br>
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:948)<br>
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:702)<br>
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:378)</p>
<p dir="auto">The debugger was run with a conditional breakpoint placed in the class AbstractAutowireCapableBeanFactory at line 530 with the condition "beanClass==null".</p>
<p dir="auto">This allowed us to identify the offending config. (The reduced) Bean config was:</p>
<p dir="auto">&lt;property name="receiptTypeControlAccountMap"&gt;<br>
&lt;map&gt;<br>
&lt;entry&gt;&lt;key&gt;&lt;ref bean="receiptTypePremiumResearch"/&gt;&lt;/key&gt;&lt;ref bean="controlAccountPremium"/&gt;&lt;/entry&gt;<br>
&lt;/map&gt;<br>
&lt;/property&gt;<br>
&lt;bean name="receiptTypePremiumResearch" class="com.jdv.stockhighway.journal.types.ReceiptType" factory-method="valueOf"&gt;<br>
&lt;constructor-arg&gt;&lt;value&gt;PREMIUM_RESEARCH&lt;/value&gt;&lt;/constructor-arg&gt;<br>
&lt;/bean&gt;</p>
<p dir="auto">This problem may be averting by using (the better) use of &lt;util:constant static-field= ie.<br>
&lt;property name="receiptTypeControlAccountMap"&gt;<br>
&lt;map&gt;<br>
&lt;entry&gt;<br>
&lt;key&gt;&lt;util:constant static-field="com.jdv.stockhighway.journal.types.ReceiptType.PREMIUM_RESEARCH" /&gt;&lt;/key&gt;<br>
&lt;ref bean="controlAccountPremium"/&gt;<br>
&lt;/entry&gt;</p>
<p dir="auto">But unsure why this is an issue with 2.5.3 and was OK with all previous 2.5 releases (2.5, 2.5.1 and 2.5.2).</p>
<p dir="auto">Other information:<br>
ReceiptType is a Java enum class and does not override the valueOf method.</p>
<p dir="auto">public enum ReceiptType implements Serializable {<br>
PREMIUM_RESEARCH("P", "Premium Research", "Premium Research"),<br>
ALERTS("A", "Alerts service", "Alerts service"),</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.3</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="398087236" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/9360" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/9360/hovercard" href="https://github.com/spring-projects/spring-framework/issues/9360">#9360</a> NullPointerException in org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=perfnorm" rel="nofollow">Jasper Rosenberg</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-1129?redirect=false" rel="nofollow">SPR-1129</a></strong> and commented</p>
<p dir="auto">The problem is that if you have a bean A that has a constructor argument that expects to be expanded by a PropertyPlaceholderConfigurer, but use A as a factory bean to create bean B, A appears to be constructed before the PropertyPlaceholderConfigurer ever gets a chance to expand A's constructor parameters.</p>
<p dir="auto">The attached simple unit test demonstrates the problem.  It works against 1.2.1 but not 1.2.2</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.2.2</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/10931/spring-ut.zip" rel="nofollow">spring-ut.zip</a> (<em>1.24 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="398058379" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/5820" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/5820/hovercard" href="https://github.com/spring-projects/spring-framework/issues/5820">#5820</a> AbstractBeanFactory.getType change dramatically alters bean instantiation order (<em><strong>"duplicates"</strong></em>)</li>
</ul>