Aug 26 2009

Spring XML and defining end of line characters in a bean property

Published by at 8:52 am under Java,Spring,XML

If you need to define and end of line character (EOL) like n in your Spring XML files in a bean property you can’t do this

<bean id="some-bean-id" class="some-class">
    <property name="my-property-name" value="n"/>
</bean>

This simply wont work. You’ll end up with a backslash followed by the letter n. What you have to do is to use an escape character like this

<bean id="some-bean-id">
    <property name="my-property-name" value="&#10;"/>
</bean>

No responses yet

Leave a Reply