title: Handling application specific exceptions in Spring Batch Tasklet approach
body: <p>How can we gracefully handle application specific exceptions in Spring Batch?</p>
  
  <p><strong>Case:</strong></p>
  
  <p>Consider a Spring Batch application(tasklet approach) containing three steps A, B, C.</p>
  
  <p><code>Step A</code> retrieves data, and in case no data is available, the job should skip the remaining steps &amp; should shut down gracefully providing an error message.</p>
  
  <p>Currently, if we throw an application specific exception, the entire trace is logged and job completes. In case there is a StepExecutionListener implementation, the afterStep method is executed before the job terminates.</p>
  
  <p>Is there a way to supress the trace?</p>
  
  <p><strong>Additional notes:</strong></p>
  
  <ol>
  <li>Step A should be in failed status.</li>
  <li>Can we use <code>setTerminateOnly()</code> in Step Execution for such purposes? If not, what is the general use of setTerminateOnly?</li>
  </ol>