Java Reference
In-Depth Information
ValidatingItemProcessor and written out to a csv, as you did in Chapter 7. To start, Listing 8-6 shows
an example of the input you will process.
Listing 8-6. customer.csv
Richard,N,Darrow,5570 Isabella Ave,St. Louis,IL,58540
Warren,L,Darrow,4686 Mt. Lee Drive,St. Louis,NY,94935
Barack,G,Donnelly,7844 S. Greenwood Ave,Houston,CA,38635
Ann,Z,Benes,2447 S. Greenwood Ave,Las Vegas,NY,55366
Laura,9S,Minella,8177 4th Street,Dallas,FL,04119
Erica,Z,Gates,3141 Farnam Street,Omaha,CA,57640
Warren,M,Williams,6670 S. Greenwood Ave,Hollywood,FL,37288
Harry,T,Darrow,3273 Isabella Ave,Houston,FL,97261
Steve,O,Darrow,8407 Infinite Loop Drive,Las Vegas,WA,90520
Erica,Z,Minella,513 S. Greenwood Ave,Miami,IL,12778
Note on line 5 of your input the middle initial field is 9S, which is invalid. This should cause your
validation to fail at this point. With your input file defined, you can configure the job. The job you will be
running will consist of a single step that reads in the input, passes it to an instance of the
ValidatingItemProcessor , and then writes it to an output file. Listing 8-7 shows the configuration for the
Listing 8-7. copyJob.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns=""
<beans:import resource="../launch-context.xml"/>
<beans:bean id="customerFile" class=""
<beans:constructor-arg value="#{jobParameters[customerFile]}"/>
<beans:bean id="customerFileReader"
<beans:property name="resource" ref="customerFile" />
<beans:property name="lineMapper">
<beans:bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<beans:property name="lineTokenizer">
<beans:property name="names"
Search WWH ::

Custom Search