I've configured my Spring Batch app below:
<batch:job id="mPortRiskJob">
    <batch:step id="mPortRiskStep">
        <tasklet throttle-limit="10">
           <chunk reader="MPortRiskReader"  processor="MPortRiskProcessor" writer="MPortRiskWriter" commit-interval="10"
            skip-limit="1">
               <batch:skippable-exception-classes>
                   <include class="com.common.exception.ERDException"/>
               </batch:skippable-exception-classes>
           </chunk>
            <batch:no-rollback-exception-classes>
                <include class="com.common.exception.ERDException"/>
            </batch:no-rollback-exception-classes>
        </tasklet>
    </batch:step>   
    <batch:listeners>
        <batch:listener ref="MJobExecutionListener"/>
    </batch:listeners>    
</batch:job>
In my writer, I have a for-loop that inserts records into the database. The code looks like below:
for (String id : keylist) {
  try {
      insertRecord(id);
  } catch (Exception e) {
      throw new ERDException("Failure in write method", e);
  }
}
What I want is if, for instance, the first record throws a DuplicateKeyException, for that record to be skipped, and the next record to be inserted. What's happening is, when the ERDException 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?