title: Want to get total row count in footer of spring batch without customizing writer(Delegate Pattern)
body: <p>This is my footer class:--</p>
  
  <pre><code>public class SummaryFooterCallback extends StepExecutionListenerSupport implements FlatFileFooterCallback{
  
      private StepExecution stepExecution;
  
      @Override
      public void writeFooter(Writer writer) throws IOException {
          writer.write("footer - number of items written: " + stepExecution.getWriteCount());
      }
  
      @Override
      public void beforeStep(StepExecution stepExecution) {
          this.stepExecution = stepExecution;
      }
  
  
  }
  </code></pre>
  
  <p>This is my xml:--</p>
  
  <p><code>&lt;bean id="writer" class="org.springframework.batch.item.file.FlatFileItemWriter"&gt;
          &lt;property name="resource" ref="outputResource" /&gt;
          &lt;property name="lineAggregator"&gt;
              &lt;bean class="org.springframework.batch.item.file.transform.PassThroughLineAggregator" /&gt;
          &lt;/property&gt;
          &lt;property name="headerCallback" ref="headerCopier" /&gt;
          &lt;property name="footerCallback" ref="footerCallback" /&gt;
      &lt;/bean&gt;
  &lt;bean id="footerCallback" class="org.springframework.batch.sample.support.SummaryFooterCallback"/&gt;</code></p>
  
  <p>Failing at stepExecution.getWriteCount() with nullpointer Exception.</p>
  
  <p>No, I haven't registered callback as a listener in the step. I am new to Java and Spring Batch, referring to your book Pro Spring Batch but not able to get the solution of the assigned task.</p>