public TaskletStep build() {
registerStepListenerAsItemListener();
registerAsStreamsAndListeners(getReader(), getProcessor(), getWriter());
registerStepListenerAsChunkListener();
BatchletStep step = new BatchletStep(getName(), batchPropertyContext);
super.enhance(step);
step.setChunkListeners(chunkListeners.toArray(new ChunkListener[0]));
if (getTransactionAttribute() != null) {
step.setTransactionAttribute(getTransactionAttribute());
}
if (getStepOperations() == null) {
stepOperations(new RepeatTemplate());
if (getTaskExecutor() != null) {
TaskExecutorRepeatTemplate repeatTemplate = new TaskExecutorRepeatTemplate();
repeatTemplate.setTaskExecutor(getTaskExecutor());
repeatTemplate.setThrottleLimit(getThrottleLimit());
stepOperations(repeatTemplate);
}
((RepeatTemplate) getStepOperations()).setExceptionHandler(getExceptionHandler());
}
step.setStepOperations(getStepOperations());
step.setTasklet(createTasklet());
ItemStream[] streams = getStreams().toArray(new ItemStream[0]);
step.setStreams(streams);
try {
step.afterPropertiesSet();
}
catch (Exception e) {
throw new StepBuilderException(e);
}