java - How i can change tag name in spring batch xml -
i have spring batch project create xml file, return this:
<units> <pojo.unitgen> <event>z_receiving_result</event> <type>receipt</type> <internaldeviceid>6</internaldeviceid> <imei>990000223446789</imei> </pojo.unitgen> <pojo.unitgen> <event>z_receiving_result</event> <type>receipt</type> <internaldeviceid>2</internaldeviceid> <imei>992000123456789</imei> </pojo.unitgen> </units>
how can change tag 'pojo.unitgen' 'unit'
this itemwriter:
<!-- write extracted receiving data xml file --> <bean id="iwreceiving" class="org.springframework.batch.item.xml.staxeventitemwriter" scope="step"> <property name="resource" value="file:${report.pathtosave}${report.filename}" /> <property name="marshaller" ref="unitmarshaller" /> <property name="roottagname" value="units" /> </bean> <bean id="unitmarshaller" class="org.springframework.oxm.xstream.xstreammarshaller"> <property name="autodetectannotations" value="true"/> </bean>
i'm assuming, have class "unitgen" inside package "pojo", right? try use annotation "@xstreamalias":
package pojo; @xstreamalias("unit") public class unitgen { ... }
you have set annotated classes:
<bean id="unitmarshaller" class="org.springframework.oxm.xstream.xstreammarshaller"> <property name="autodetectannotations" value="true"/> <property name="annotatedclasses"> <list> <value>pojo.unitgen</value> </list> </property> </bean>
Comments
Post a Comment