Java – how to set null to integer in spring context

This is only a small part of my background:

<property name="a" value="1"/> where a is Integer.

How do I set null to this value?

Solution

You can use the element < null / > to represent a null value:

<property name="a" value="1"/><null/></property>

Editor: more information is available in the official spring 2.5 document: http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans -null-element

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>