How to Inject Null or Blank values to a Spring Bean

To inject an NULL value which is equivalent to bean.setMessage(null):

<bean id=”beanId” class=”bean”>
<property name=”message”><null/></property>

To inject an empty Stringe which is equivalent to bean.setMessage(“”)

<bean id=”beanId” class=”bean”>
<property name=”message” value=””></property>


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.