title: Spring Batch - Validate Header Lines in input csv file and skip the file if it invalidates
body: <p>I have a simple job as below:</p>
  
  <pre><code>&lt;batch:step id="step"&gt;
   &lt;batch:tasklet&gt;
    &lt;batch:chunk reader="itemReader" processor="itemProcessor" writer="itemWriter" commit-    interval="5000" /&gt;
   &lt;/batch:tasklet&gt;
  &lt;/batch:step&gt;
  </code></pre>
  
  <p>itemReader is as below:</p>
  
  <pre><code>&lt;bean id="itemReader" class="org.springframework.batch.item.file.FlatFileItemReader"
  scope="step"&gt;
   &lt;property name="linesToSkip" value="1"&gt;&lt;/property&gt;
   &lt;property name="skippedLinesCallback" ref="skippedLinesCallback" &gt;&lt;/property&gt;
  
   &lt;property name="lineMapper"&gt;
      &lt;bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"&gt;
                  &lt;property name="lineTokenizer" ref="lineTokenizer"&gt;                
                  &lt;property name="delimiter" value="," /&gt;                    
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="fieldSetMapper"&gt;
              &lt;bean
                  class="org.springframework.batch.item.file.mapping.PassThroughFieldSetMapper" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/property&gt;
  &lt;property name="resource" value="#{stepExecutionContext['inputKeyName']}" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id"lineTokenizer"                        class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"&gt;
  
  &lt;bean id="skippedLinesCallback" class="com.test.IteMReaderHeader" &gt;
  &lt;property name="lineTokenizer" ref="lineTokenizer"&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I am setting the "names" of the input fields in "com.test.IteMReaderHeader" class by injecting "lineTokenizer" in it.</p>
  
  <p>I need to validate the header lines which is the 1st line in the input csv file with a fixed header value and if the header line invalidates then in that case I need to fail the step and skip the entire file so that the next file can be used for reading.</p>
  
  <p>Please suggest a suitable way of achieving it.
  I would really appreciate your time and valuable inputs.</p>
  
  <p>Thanks !!</p>