title: What is EJB alternative in Spring Framework
body: <p>I am trying to learn Spring Framework, before that I used to create application with EJBs</p>
  
  <p><code>[Web services]-&gt;[Business Layer]-&gt;[DAO Layer]</code> | [Database]</p>
  
  <p>in following way</p>
  
  <ol>
  <li><p><strong>WebServices</strong>: Restful API using <code>Jersey</code> with <code>url mappings</code>, that support both JSON and XML format( <code>news/list.json</code>, <code>news/list.xml</code>). Once a request is received by an endpoint(url-mapped-method) it is forwarded to a relevant EJB through lookup(remote, local). EJB process every thing, apply business rules and return result as DTO(Data transfer object),Service then transform the result into required format (JSON, XML)</p></li>
  <li><p><strong>Business Layer</strong>: Business Layer (Facade) implemented in <code>EJB</code> with <code>remote</code> and <code>local</code> interfaces, these EJBs can call other EJBs. WebService layer(and/or Timer service and MDBs) can also call any of the EJBs). For timer service related functionality I used <code>EJB Timer Service</code> and for Messages used <code>Message Drive Bean</code> and interceptor for logging and auditing.</p></li>
  <li><p><strong>DAO Layer</strong>: All the Database related functions(add,edit, delete, search) <code>JPA/Hibernate</code> using <code>EntityManager</code> are written here (Entity beans and HQL). 
  Seamless Transaction support, each EJB's method (lookup-based) call is treated as a separate transaction and calling methods of DAO layer are part of same transaction(provided that no extra configuration is provided). multiple operations are carried out in a single transaction If one db operation fails all others are roll backed automatically. Each Table is mapped as an entity class with relations etc.</p></li>
  </ol>
  
  <p>I have worked on <code>Spring MVC</code> but could not map/understand correctly for above architecture
  I know bit about AOP and that I think is a perfect replacement for Interceptors (or at least it work for me)</p>
  
  <p><strong>Now my question is how all these could be replaced in Spring framework</strong>?</p>
  
  <ol>
  <li>Jersey (RestAPi) alternative in Spring></li>
  <li>EJB alternative in Spring (as EJB supports remoting, each lookup call to a method is treated as a transaction, calls to EJB's method could be intercepted and it comes with state-full and stateless flavors)?</li>
  <li>Timer Service alternative in Spring?</li>
  <li>Message Drive Bean alternative in Spring?</li>
  <li>Interceptor alternative is AOP in Spring (As per my experience and that serve my purpose)</li>
  <li>JPA(entity manager) alternative in spring?</li>
  </ol>