Tag Archives: Java EE

Wiring up EJBs using Spring

In my recent work, I wanted to wire up my EJB 3 Service Facades using Spring 2.5. I looked for an existing solution to get this done, and it did not turn out to be successful. So I thought of writing my own solution to overcome this using Aspect Oriented Programming (AOP).

Looking into how Spring performs its magical bean wiring, I read through the source code of Spring, and found out that Spring uses the concept of BeanConfigurer and BeanWiringInfoResolver to resolve dependencies for a POJO. Since I was interested on annotations based configuration, I read through the code and found that AnnoationBeanWiringInfoResolver is capable of doing the wiring up for any POJO, by reading through present annotations for that type.

However, since I wanted to make sure that only my EJBs will be wired up using this approach, I decided to extend the AnnotationBeanWiringInfoResolver to provide my own implementation which only does this special treatment.
Continue reading

A Thought about Java EE Applications

Most of the software houses in my country seem to have embraced the concept of EJB3 hardly, for new projects. They develop new projects (and ports) using EJB3 as the middle tier technology, for various reasons.  Majority of the companies also employ Spring Framework as a part of their solutions as well. With the additions of JEE support (XML Bean Definitions) in Spring, the two technologies complements each other, and can be used to promote good programming practices like coding to interfaces, through Spring’s Inversion of Control support. Also, companies are embracing JPA, due to the simple nature of the technology, through “convention over configuration”. Finally, because of the use of EJBs, the solution is deployed into a full blown application server such as JBoss, Websphere, WebLogic etc. 

However, most of these applications are just web applications. And the architecture of these solutions are not distributed. All components of the solution live in a single VM. This raises the question, why do we need EJB? Well, in my perspective, I think it’s basically due to the fact that most developers think EJB is a core part of J2EE stack, and it should be there no matter what. If the final solution is deployed into a clustered environment, if the app is going to be executed in a distributed manner on several VMs, then yes, EJB is the way to go; but why for a webapp which runs in a single VM? Majority of the projects out there are not multi-modular distributed applications. They are single module web applications. IMO, using a technology like EJB is overkill for this type of projects. 

Continue reading