Hi,

I have a working Spring Application (MVC) and I want to initialise a Map property, but I am getting BeanCreationException. For example:

Code:
Error creating bean with name 'myprops2' defined in ServletContext resource [/WEB-INF/servlet-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ilt.myport.MySpecial]: Constructor threw exception; nested exception is java.lang.NullPointerException
My servlet-content.xml file includes the following entry:

Code:
<beans:bean id="myprops2" class="com.ilt.myport.MySpecial">
  <beans:property name="myprops2">
     <beans:map>
        <beans:entry key="myFieldType" value="Special X Key" />
        <beans:entry key="myFieldActive" value="true" />
    </beans:map>
  </beans:property>
</beans:bean>
My class' snippet is:

Code:
// declaration
private Map<String,String> myprops2;

// setter for bean instantiation
public void setMyprops2(Map<String, String> myprops2) {
   this.myprops2 = myprops2;
}
And of course, my classes are on the classpath as the MVC configuration works fine.

Also, I would like to know if it is possible to initialise static collections, that is, intead of the above declaration, if I had:

Code:
private static Map<String,String> myprops2;

public static void setMyprops(Map<String, String> myprops) {
   MySpecial.myprops = myprops;
}
...would that be fine with the same bean configuration? If not, what is the work around?