Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Given that Spring Batch is a batch framework that does not deal with user input, I'm not sure you're working with the right scenario here. However, there are a few different options here:</p> <ol> <li><p>Use a job parameter and a decision step to direct to the correct combination of ItemReader/ItemWriter. The disadvantage of this is that you would need to define a step per implementation (one to handle PDF, one for Excel, etc), however since the choice would be done only once per run of the job it would have less of an impact on performance.</p></li> <li><p>A cleaner approach would still use a job parameter, however it would use the ClassifierCompositeItemWriter to delegate to the appropriate writer. This ItemWriter would be configured with one ItemWriter delegate per implementation type (PDF, Excel, etc) and would dictate to them based upon the implementation of the Classifier interface you configure. While this is a cleaner approach from a configuration standpoint, it has the disadvantage of evaluating each of the individual items for which ItemWriter to processs (it's a disadvantage assuming that the entire run is intended to send all of the items to the same ItemWriter per run).</p></li> <li><p>Finally, I would think that you should be able to, in theory, use Spring's bean factory concepts to inject an ItemWriter when the job starts. For the record, this is purely speculation and I have not actually tried this.</p></li> </ol> <p>Michael T Minella<br/> Author of <a href="http://www.apress.com/9781430234524" rel="nofollow">Pro Spring Batch</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload