Your delegate isn't getting opened. The easiest way to address this is to update the open
, close
, and update
methods to call the corresponding methods on the delegate as well. This also allows for restartability (which your current version would not because the state of the delegate is not being saved):
@Override
public void close() throws ItemStreamException {
delegate.close();
}
@Override
public void open(ExecutionContext arg0) throws ItemStreamException {
delegate.open(arg0);
}
@Override
public void update(ExecutionContext arg0) throws ItemStreamException {
delegate.update(arg0);
}
The alternative is to register your FlatFileItemReader
as a stream in your step. You'll have to pull it out to a separate bean definition if you want to go that route.
You can read more about ItemStream
s and how their lifecycle works and how it is impacted via delegation here: http://docs.spring.io/spring-batch/reference/html-single/index.html#itemStream