Hi,
I’ve written a job that extracts several (business defined) data types from a database and writes each of the data types to a separate xml file. To aid in performance each of the data types are split into several threads using the partitioning feature of spring batch. Once all these steps have completed another step then merges all the fragments into one file. For this I am using the following dependencies:
Spring Batch 2.1.6
Spring 3.0.0
Spring oxm 1.5.9
Spring oxm tiger1.5.9
For completeness I have attached my pom.xml for the other dependencies.
To accomplish the above requirements I am using the following classes
org.springframework.batch.item.xml.StaxEventItemRe ader
org.springframework.batch.item.xml.StaxEventItemWr iter
org.springframework.oxm.jaxb.Jaxb2Marshaller
The job is extracting everything as expected however it is writing everything onto a single line. To overcome this I have tried setting the Marshaller propertyto format the xml but this doesn’t format the xml. Here is xml I am using to configure the StaxEventItemWriter.Code:javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT
Code:<bean id="mergeFilesWriter" scope="step" class="org.springframework.batch.item.xml.StaxEventItemWriter"> <property name="resource" value="file:#{jobExecutionContext['dailyExtractFileName']}" /> <property name="marshaller" ref="DailyExtractJAXB2Marshaller" /> <property name="rootTagName" value="DailyExtract" /> <property name="overwriteOutput" value="true" /> <property name="saveState" value="${mergeFiles.saveState}" /> </bean> <bean id="DailyExtractJAXB2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="classesToBeBound"> <list> <value>org.atoc.batch.dss.jaxb.DailyExtract</value> </list> </property> <!-- This is meant to format the marshalled xml data wth linefeeds and indention but doesn't work unfortunately! --> <property name="marshallerProperties"> <map> <entry> <key> <util:constant static-field="javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT" /> </key> <value type="boolean">true</value> </entry> </map> </property> </bean>
Could someone please tell me what I’m going wrong or this is a bug?
Thanks in advance
Dave


Reply With Quote
,

