A prototype of the resources to
be created by
use this class to append a
suffix to the end of the file
names it creates.
If false , the state of the
ItemWriter isn't maintained in
To see how this works, you extract customers from the database and create XML files containing 10
customers each. To make this work, you don't need to develop any new code (you created the XML). All
you need to do is wire everything up. Let's start working with this example by looking at the
configuration for the job.
Listing 9-62 shows the configuration for the ItemReader in this example. In this case, it's a simple
JdbcCursorItemReader configured to select all customers. From there, you pass the customers you
receive from the database to the ItemWriter you configure next.
Listing 9-62. The multiResource formatJob 's ItemReader
<beans:property name="dataSource" ref="dataSource"/>
<beans:property name="sql" value="select * from customer"/>
<beans:property name="rowMapper" ref="customerRowMapper"/>
The configuration for this ItemWriter is in layers. First you configure the StaxEventItemWriter that
you use for the XML generation. With that configured you layer MultiResourceItemWriter on top to
generate multiple resources the StaxEventItemWriter writes to. Listing 9-63 shows the configuration of
the output half of the job as well as the step and job configuration.
Listing 9-63. ItemWriters and Step and Job Configuration