Pages

Sunday, October 21, 2012

mistake when injecting null value to a variable or construct

Say you need to inject null value to a property. How would you do it? Let me guess.

<bean id="youclassid"class="yourclass">
        <property name="distance" value="null" />
</bean>

Sorry to disappoint you. The above code will not work. The correct way is shown below.


<bean id="youclassid"class="yourclass">
<property name="distance"  /><null/></property>
</bean>


No comments:

Post a Comment