How to set null to Integer in spring context
You can use the <null/>
element to specify a null value:
<property name="a" value="1"/><null/></property>
Edit: The official spring 2.5 documentation has more info: http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-null-element p>
There is a way to set the value to zero in the Spring configuration file.
Spring:
<bean class="SampleBean"> <property name="name"><value></value></property> </bean>
The results in the name property are set to ", which is equivalent to the java code: sampleBean.setName (" "). The special <null>
element can be used to specify a null value, so:
Spring:
<bean class="ExampleBean"> <property name="email"><null/></property> </bean>
The above configuration is equivalent to java code:
Java:
exampleBean.setEmail(null).
See this link: http://www.java-forums.org/java-tip/3218-how-set-null-value-springs-configuration-file.html