title: Designing custom workflow in JAVA and Spring
body: <p>I am working on an spring 2.0.1.RELEASE application.</p>
  
  <blockquote>
    <p><strong>Brief of Application:</strong></p>
  </blockquote>
  
  <pre><code>1. I have separate Transformer beans that transforms my DTO to Domain
  and vice versa.
  2. I have separate Validator beans that validate my domain object being passed.
  3. I have Service classes that takes care of the applying rules and calling persistence layer.
  </code></pre>
  
  <hr>
  
  <blockquote>
    <p>Now, i want to build a <strong>Workflow</strong> in my application:
    where i will just call the start of the workflow and below mentioned steps will be executed in order and exception handling will be done as per the step:</p>
  </blockquote>
  
  <pre><code>1.First-Transformtion - transformToDomain() method will be called for that object type.  
  2.Second-Validator - class valid() method will be called for that object.  
  3.Third-Service - class save() method will be called for that object.  
  4.Fourth- Transformation - transformToDTO() method will be called for that object type.
  </code></pre>
  
  <p>after this my workflow ends and i will return the DTO object as response of my REST API.</p>
  
  <p>Exception handling part is the one, i also want to take care of, like if particular exception handler exist for that step then call it, else call global exception handler.</p>
  
  <p>I designed some prototype of same, but looking for some expert advice and how this can be achieved with a better design in java.</p>
  
  <hr>
  
  <p><strong>Explanation with example considering above use case is highly appreciable.</strong></p>