<beans xmlns="http://www.springframework.org/schema/beans" xmlns:batch="http://www.springframework.org/schema/batch"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/batch
    http://www.springframework.org/schema/batch/spring-batch-3.0.xsd
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
">

    <import resource="spring.xml" />

    <bean id="itemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
        <property name="resource" value="input/record.csv" />
        <property name="lineMapper">
            <bean
                class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
                <property name="lineTokenizer">
                    <bean
                        class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
                        <property name="names"
                            value="username,userid,transaction_date,transaction_amount" />
                    </bean>
                </property>
                <property name="fieldSetMapper">
                    <bean
                        class="org.baeldung.spring_batch_intro.service.RecordFieldSetMapper" />
                </property>
            </bean>
        </property>
        <property name="linesToSkip" value="1" />
    </bean>

    <bean id="itemProcessor" class="org.baeldung.spring_batch_intro.service.CustomItemProcessor" />

    <bean id="itemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter">
        <property name="resource" value="file:xml/output.xml" />
        <property name="marshaller" ref="recordMarshaller" />
        <property name="rootTagName" value="transactionRecord" />
    </bean>

    <bean id="recordMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="classesToBeBound">
            <list>
                <value>org.baeldung.spring_batch_intro.model.Transaction</value>
            </list>
        </property>
    </bean>

    <batch:job id="firstBatchJob">
        <batch:step id="step1">
            <batch:tasklet>
                <batch:chunk reader="itemReader" writer="itemWriter"
                    processor="itemProcessor" commit-interval="10">
                </batch:chunk>
            </batch:tasklet>
        </batch:step>
    </batch:job>
</beans>
