Java Reference
In-Depth Information
Listing 8-11. Updated Configuration for the customerValidatingProcessor Bean
<beans:bean id="customerValidatingProcessor"
<beans:property name="validator">
<beans:bean class="com.apress.springbatch.chapter8.BeanValidator"/>
When you run the job with your new configuration and your input is updated to pass validation by
removing the 9 from the middleInitial field of the fifth record, Listing 8-12 shows the results you get.
Listing 8-12. Results of New Logic Applied to the Customer Item
2011-02-13 17:35:00,234 DEBUG main []
- <Repeat operation about to start at count=9>
2011-02-13 17:35:00,234 DEBUG main []
- <Repeat operation about to start at count=10>
2011-02-13 17:35:00,234 DEBUG main []
- <Repeat is complete according to policy and result value.>
Richard Darrow was record number 1 in your file.
Warren Darrow was record number 2 in your file.
Barack Donnelly was record number 3 in your file.
Ann Benes was record number 4 in your file.
Laura Minella was record number 5 in your file.
Erica Gates was record number 6 in your file.
Warren Williams was record number 7 in your file.
Harry Darrow was record number 8 in your file.
Steve Darrow was record number 9 in your file.
Erica Minella was record number 10 in your file.
2011-02-13 17:35:00,235 DEBUG main [org.springframework.batch.item.file.FlatFileItemWriter]
- <Writing to flat file with 10 items.>
2011-02-13 17:35:00,236 DEBUG main
[org.springframework.batch.core.step.item.ChunkOrientedTasklet] - <Inputs not busy, ended:
The ValidatingItemProcessor is useful for being able to apply validation to your items as they are
processed. However, it is only one of the three implementations of the ItemProcessor interface provided
by Spring Batch. In the next section you will look at the ItemProcessorAdapter and how it allows you to
use existing services as ItemProcessors.
In Chapter 7, you looked at the ItemReaderAdapter as a way to use existing services to provide input to
your jobs. Spring Batch also allows you to put to use the various services you already have developed as
ItemProcessors as well by using the org.springframework.batch.item.adapter.ItemProcessorAdapter .
Search WWH ::

Custom Search