Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring IOC issues in MVC WebApplication with JSF integration  RSS feed

Jaik Singh
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am getting null pointer exception while using spring's IOC feature in my application.

I have created one Spring + JSF Application in Eclipse ID given instruction at link
This is working fine.

I tried to modify this code and instead of initializing the Map from the default constructor I have added below code in applicationContext.xml like

<util:map id="stockSymbolsAndValuesMap" map-class="java.util.HashMap">
<entry key="AAA" value="100"></entry>
<entry key="BBB" value="200"></entry>
<entry key="CCC" value="300"></entry>
<entry key="DDD" value="400"></entry>
<entry key="EEE" value="500"></entry>

and add this id's ref something like below.

<bean id="stockBean"
<property name="stockBeanValue" ref="stockBean"></property>

and modified the bean some thing like

public class StockValueFetcher {

private Map<String, String> stockSymbolsAndValues;
// with some getters and setters


while taking this map to my public String findStockValue() method I am getting null when I do stockSymbolsAndValues.containsKey(symbolName);.

I did this map injection in plain java main spring program and its working fine. So, in this case am I doing anything wrong or missing anything. Please guide me on this.

Thanks And Regards

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!