title: How to define templates for Spring Batch jobs?
body: <p>I'm using Spring Batch 2.1.5. I have many jobs that are very similar between each other and I'm looking for a way to have an smaller XML acting as a job template.</p>
  
  <p>The things that are shared among jobs are readers, processors, writers and one tasklet. Also some of the parameters for each of these beans are the same. For instance they all use the same data source.</p>
  
  <p>I thought about 4 approaches and 3 of them don't work...</p>
  
  <p>1 - Using a postprocessor to add the common beans and attributes as default values is not possible, because the Spring Batch class JobParserJobFactoryBean is not a public class.</p>
  
  <p>2 - To add an XML extension seems to be a wrong thing, because I'm not adding any custom tags to the XML file.</p>
  
  <p>3 - Using a PropertyOverrideConfigurer I can put default values into properties, but I have to define those values for each bean. So I'll have many repeated values and I'll only move the problem to properties.</p>
  
  <p>4 - Using some kind of custom factory bean. These seems to be the only choice, but I don't know exactly how to plug it into the existing code.</p>
  
  <p>Did anybody try to do this? Can somebody give tips or recommend resources on how to do it?</p>