Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring vs EJB  RSS feed

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A simple question: what questions should I made myself on choosing which framework to adopt, Spring or EJB? Any links about it?

Thanks,
Wagner Danda
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wagner, perhaps I am not the correct person to answer this question as I am quite biased towards Spring. I have been doing EJB since about 2000, WebLogic 5.1 and continue to use EJB.

One great book on the subject is "J2EE Development without EJB", by Rod Johnson. Personally, I find EJBs mostly useless. No one, that I know of, uses the security model, Stateful Session Beans are a joke, and Entity Beans are a difficult way to go just to model your data. The only thing that I've seen that is useful in EJBs are the Stateless Session Beans, and only because they can provide transactions.

There is a better way to get transactional control of your objects and that is through Spring. EJB requires that you create a minimum of about 4 files, just to use it. Surely, there are things that have come a long that make it less painful, like Xdoclet, to do the grunt work of generating Java files and XML (ejb-jar.xml) files.

Mostly it's a waste of time and it's the managers that seem to eat up the 'marketecture'. Also, if you've ever tried to run JUnit against an EJB, it's extremely difficult.

With Spring you can use POJOs. Testing is a breeze. However, don't take my word for it, please. Try to learn EJBs, use them, then try Spring. I'm sure that you'll never look back.
 
Wagner Danda Da Silva Filho
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Paul, thanks for you comments.

I've been using Spring since July and I've noticed how easy is to use-it! Unfortunately, the project I work is not a big one so I still have a doubt whether Spring would be applicable to large systems (e.g. with 2 or more application servers)... If you have this kind of experience with Spring, please let me know.

Thanks again!

Wagner Danda
 
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I've been using Spring since July and I've noticed how easy is to use-it! Unfortunately, the project I work is not a big one so I still have a doubt whether Spring would be applicable to large systems (e.g. with 2 or more application servers)... If you have this kind of experience with Spring, please let me know.



I am going to develop a small project. I am new to spring and the application I am going to develope is a web application. Do you think Spring satisfies MVC model as of Struts.
 
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jignesh Patel:
I am going to develop a small project. I am new to spring and the application I am going to develope is a web application. Do you think Spring satisfies MVC model as of Struts.


Yes, Spring provides you with all the same MVC goodness as Struts does.
Except that it does it without making you regret that you decided to go with Spring

Having said that, if you already know Struts well enough to be productive with it (and if you don't consider the "professional development" aspect of learning a new framework) then I'd say going with Struts is not such a bad idea either.

Then again, if you're serious about ensuring the quality of your code through automated tests then Spring will make your life much easier than Struts. This is mostly because in Spring, controllers (similar to Struts' actions) are just beans and are thus blessed by the same dependency injection features as any other Spring-wired components.
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Then again, if you're serious about ensuring the quality of your code through automated tests then Spring will make your life much easier than Struts. This is mostly because in Spring, controllers (similar to Struts' actions) are just beans and are thus blessed by the same dependency injection features as any other Spring-wired components.



Thanks for valuable inputs. I am thinking of going with spring webflow(which looks very similar to weblogic pageflow) and hibernate without integration of JSF or struts.
[ October 25, 2005: Message edited by: Jignesh Patel ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!