Updating Spring Batch jobs from 1.0.0.m4 to 1.0.0.m5 framework

The following is a description of what is needed to migrate the samples from m4 to the m5 release.


  • Tasklet's role has changed - It is no longer called iteratively, but is now dedicated for tasks that are not natural to split into read-write phases (e.g. calling stored procedure or system command). Readers and writers are now typically injected into (ItemOriented)Step. See Tasklet and TaskletStep javadoc for more details.
  • Step scope removed - lifecycle of readers and writers explicitly handled by Step. They need to be registered for the lifecycle callbacks with the step. This is automatic if using one of the new step factory beans, but only for the directly injected reader and writer. Any indirect dependencies need to be registered separately (using the streams property of the factory bean).
  • When launching from command line there is one applicaton context for job rather than parent container and child job context. CommandLineJobRunner requires only one xml file location. It is recommended to use a new ApplicationContext per job execution for other use cases involving launching multiple jobs in a single VM. The JMX demo in the samples shows this in practice.
  • SimpleFlatFileItemReader and DefaultFlatFileItemReader merged into FlatFileItemReader
  • LineAggregator is now inverse to LineTokenizer - method signature changed to 'String aggregate(FieldSet)'.


  • Modularized repository daos - JobInstanceDao, JobExecutionDao and StepExecutionDao instead of JobDao and StepDao.
  • Step creation handled by factories.


  • ItemStream now has single 'open(ExecutionContext)' rather than 'open()' and 'restoreFrom(ExecutionContext)'.
  • ItemStream no longer has mark() and reset() methods - moved to ItemReader. ItemWriter uses more intuitive clear() and flush().
  • Interceptors renamed to Listeners e.g. RepeatInterceptor is now RepeatListener.
  • StepContext merged into ExecutionContext (previously ExecutionAttributes). Single ExecutionContext is now shared between ItemStreams instead of separate contexts being composed before save and decomposed after load. ItemStreams now have names to distinguish context keys of multiple ItemStreams of the same class.
  • Domain-oriented listeners introduced - JobListener, StepListener, ChunkListener, ItemReadListener, ItemWriteListener.
  • StepInstance removed from domain model.
  • Database schema updated.
  • JobInstance identity is now given by Job and JobParameters pair - identical JobInstances with different IDs no longer allowed (see JobInstance javadoc for more details).