• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

EJB3 or Spring

 
Greenhorn
Posts: 22
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
could someone help me in choosing ejb3 vs spring. I know both can be used for business layer, easy integration with hibernate/jdbc etc. I know ejb is a specification, spring is not. So, what can be driving force in choosing one?

--rams
 
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's much more a matter of taste, great things can be achieved with both, I can't really say that one is best than the other for anything. But I'm saying this because I've JEE6 in mind and not just EJB, the same is valid for Spring.

For simplicity, portability and vendor competition I would go with EJB. But I'm working with Spring and it's pretty cool, so I can't really have a opinion about it.
 
Greenhorn
Posts: 14
IntelliJ IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just as Jayr said it is much a matter of taste, but there are other consequences as well. Spring is a lightweight framework requiring just a web container. EJB (with the exception of EJB Lite) on the other hand needs application server to offer whole set of functionalities (eg Message Driven Beans, Java Mail and Java Web Services are not available in EJB Lite profile). In my opinion Spring (just as JBoss Seam) are more initiative and introduce concepts that are incorporated into EJB only after a while. However I'm still a big fan of EJBs (and a whole JEE) and encourage to get to know both technologies. It's then a matter of project specification that would help to choose best technology for particular needs.
 
Jayr Motta
Ranch Hand
Posts: 110
Google Web Toolkit Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's true about:

Spring is a lightweight framework requiring just a web container.



But in most part of the time, you'll see something different. You'll see Spring projects using the same application server that could be used by EJB, that's why everyone wants to enjoy the nice built-in features they offer, and when you use a web container with Spring, it will probably use the same or even less services than an analogous EJB project on top of a lite container.

I really like Spring, but is difficult to say which one is best. And I'll not start to state the benefits of EJB or Spring because this discussion already exists in a lot of places. The tip I can give anyone that wants write a project must think not just on the technology itself, but also on the team that's gonna use it, with all this in mind, you'll surely make the right decision!
 
Greenhorn
Posts: 20
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

My rule of thumb is that one does't use EE technologies as long as there is no real need to use it. Like technical requirement from customer or featureset that obviously would require you to "wire" yourself with application server. As a developer one of the first things to think about is a deploy time and resources consumption of a J2EE Application Server. Most of them will consume lots of resources and take a while to redeploy your application, while you'd like to see how the changed code works right away.

So if you need some simple tasks to be accomplished I'd say you should stick to spring, as servlet container would be lot more responsive to the changes that you make in your code. And servlet container will start\stop faster if you have to switch from one project to another occasionally. And besides spring would actually allow you to switch to EE technologies with few lines of code inserted, once you need them. So the approach is scalable. Start with spring - move to EE when needed.
 
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just as everyone said - do whatever suits you and whatever is simplier in your case :-)

I'd just like to mention that with Java EE 6 AS (Glassfish, JBoss AS7, Resin Caucho, ...) the deployment is really easy and fast -- just take a look at the numbers.

I would say after Marcin that the best is to know both technologies, test them and then choose the right one. One of the worst thing to do is to run to Spring because someone, somewhere said that EJB / Java EE is too overweight. It's very often heard argument which was valid in J2EE 1.4 era not in Java EE 6.

Cheers!
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic