Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are EJBs still useful? And what are the Spring Framework ways to replace EJBs?

I have read for a while that EJBs are not useful or cumbersome. But what other ways implement the business delegate pattern?

How do EJBs differ from the approach the Spring recommends?

Also, how have recent advances with EJBs changed your opinion.

like image 920
Berlin Brown Avatar asked May 13 '09 17:05

Berlin Brown


People also ask

Are EJBs still used?

EJB is still there and growing up. There are many new features (SOAP/RESTful webservice, JPA entities, JAXB...)

What is the alternative for EJB?

The Spring Framework is an application framework and IoC container for the Java platform. The framework was initially created as an alternative to EJB. Spring offers modular approach to adding new functionalities, which means that developers can use only parts they're interested in.

Which is better EJB or Spring?

The key difference between EJB and Spring is that EJB is a specification of Java EE while Spring is a framework or an implementation. Another key difference is that Spring does not support propagation of transaction context across remote calls while EJB does the same.

Does Spring use EJBs?

Spring is a framework. It can inject anything in the container including EJB Data sources, JMS Resources, and JPA Resources.


1 Answers

If your goal was to start a flame war, replace "EJB" with "Java" and "Spring Framework" with "Ruby on Rails".

If not, check out Rod Johnson's book from 2004 for detailed explanation of why EJBs got such an awful reputation and what Java development issues Spring was designed to remedy.

While the book is five years old at point and predates EJB3, and you need to filter out the subjective and anecdotal; keep in mind on little thing. It is simple to google for examples of migrating from EJB to Spring, it is almost impossible to find stories of Spring to EJB3 migration. I don't think that is by accident.

like image 106
sal Avatar answered Oct 20 '22 19:10

sal