title: Spring Batch: Skip Exception not behaving as expected
body: <p>I've configured my Spring Batch app below:</p>
  
  <pre><code>&lt;batch:job id="mPortRiskJob"&gt;
      &lt;batch:step id="mPortRiskStep"&gt;
          &lt;tasklet throttle-limit="10"&gt;
             &lt;chunk reader="MPortRiskReader"  processor="MPortRiskProcessor" writer="MPortRiskWriter" commit-interval="10"
              skip-limit="1"&gt;
                 &lt;batch:skippable-exception-classes&gt;
                     &lt;include class="com.common.exception.ERDException"/&gt;
                 &lt;/batch:skippable-exception-classes&gt;
             &lt;/chunk&gt;
              &lt;batch:no-rollback-exception-classes&gt;
                  &lt;include class="com.common.exception.ERDException"/&gt;
              &lt;/batch:no-rollback-exception-classes&gt;
          &lt;/tasklet&gt;
      &lt;/batch:step&gt;   
      &lt;batch:listeners&gt;
          &lt;batch:listener ref="MJobExecutionListener"/&gt;
      &lt;/batch:listeners&gt;    
  &lt;/batch:job&gt;
  </code></pre>
  
  <p>In my writer, I have a for-loop that inserts records into the database. The code looks like below:</p>
  
  <pre><code>for (String id : keylist) {
    try {
        insertRecord(id);
    } catch (Exception e) {
        throw new ERDException("Failure in write method", e);
    }
  }
  </code></pre>
  
  <p>What I want is if, for instance, the first record throws a <code>DuplicateKeyException</code>, for that record to be skipped, and the next record to be inserted. What's happening is, when the <code>ERDException</code> is thrown, Spring Batch retries all the records, including the duplicate. I want it to discard that particular record and insert the others. Is there a way to accomplish that?</p>