March 8, 2009

Spring integration with EJB 2.x

These days I am working on a bank web application. This application needs to be developed in synch with an 8 years old web application. The problem is as old application is running fine from a long time; manager wants us to develop it using the same frameworks. The ancient configuration is struts1.3 + EJB 2.1 + iBatis which is not it all test friendly.

Finally we are trying our luck with the kinda fusion of both old and new.  For the middle layer I am trying to minimize side effects of EJB 2.1 by wrapping it around with Spring.

Spring's support to EJB integration can be grouped into two categories:

  1. EJB access using Spring
  2. EJB implementaion using Spring

Accessing EJB with the help of Spring, makes it easy. Spring extends basic JNDI support framework and utilizes AOP support to provide proxy-based access to EJB resources.

Spring provides abstract base classes to support EJB implementation. Abstract classes help to create 3 types of EJBs.

  • Stateless Session Beans
  • Stateful Session Beans
  • Message Driven Beans

There is no support to Entity beans. 
Spring implementation not only eases the burden of creating EJB but makes easy access to Spring managed resources within the beans. It helps to factor business logic out of the EJB implementation and into a POJO used by EJB.

Till now I have been able to implement EJB with Spring and its successfully deployed in WebSphere Application Server  5.1.

May be next time I will post a tutorial on this exercise.

No comments:

Post a Comment