Java Reference
In-Depth Information
Listing 9-74. Reading in the customerWithEmail.csv File
<beans:bean id="customerFile"
class="" scope="step">
<beans:constructor-arg value="#{jobParameters[customerFile]}"/>
<beans:bean id="customerFileReader"
<beans:property name="resource" ref="customerFile"/>
<beans:property name="lineMapper">
<beans:property name="lineTokenizer">
<beans:bean class="org.springframework.batch.item.file.transform.
<beans:property name="names"
<beans:property name="delimiter" value=","/>
<beans:property name="fieldSetMapper">
<beans:bean class="org.springframework.batch.item.file.mapping.
<beans:property name="prototypeBeanName" value="customer"/>
<beans:bean id="customer" class="com.apress.springbatch.chapter9.Customer"
Nothing in Listing 9-74 should be unfamiliar. You're using the same input file you used in the
previous examples in this chapter. The configuration consists of the file reference ( Resource ), the
configuration of the FlatFileItemReader using DelimitedLineTokenizer and BeanWrapperFieldSetMapper
to read the file, and a reference to the Customer bean to create them as required.
On the output side, you need to create three ItemWriters: the XML writer and its dependencies, the
JDBC writer and its dependencies, and the CompositeItemWriter that wraps both of the other writers.
Listing 9-75 shows the configuration for the output of this step as well as the configuration for the step
and job.
Listing 9-75. Output, Step, and Job Configuration
<beans:bean id="outputFile"
class="" scope="step">
Search WWH ::

Custom Search