0

I am facing a problem while trying to store an end line separator in a java properties file in order to import it into an xml configuration file.

With the following xml :

<bean id="fooWriter" class="org.springframework.batch.item.file.FlatFileItemWriter">
    <property name="resource" value="file:${myJob.file.output}" />
    <property name="lineSeparator" value="${myJob.file.lineSeparator}" />
</bean>

The following property entry :

myJob.file.lineSeparator = &#10;

Gives : foo&#10;bar


myJob.file.lineSeparator = \n

Gives : foobar(Nothing)


myJob.file.lineSeparator = \\n

Gives : foo\nbar


myJob.file.lineSeparator = '\n' or "\n"

Gives :

foo' or foo"
'bar or "bar

it seems like it's working but the quotes remains.


Any solution to externalize the endline separator ?

Charles Follet
  • 827
  • 1
  • 10
  • 28

1 Answers1

0

it does work for me with Spring 4 and

a properties file containing

lineSeparator=\n

spring configuration

<context:property-placeholder location="classpath:META-INF/spring/my.properties"/>

spring batch configuration (removed file path config)

<bean id="itemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter" scope="step" >
    <property name="lineSeparator" value="${lineSeparator}" />
</bean>
Michael Pralow
  • 6,560
  • 2
  • 30
  • 46