aspose file tools
The moose likes Spring and the fly likes Why Spring ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Why Spring ?" Watch "Why Spring ?" New topic

Why Spring ?

Debopam Poddar
Ranch Hand

Joined: Jun 21, 2005
Posts: 51

Evolution of Spring came at the time of EJB2 when EJB was tough to understand and code as well,lots of unnecessary code needed. But with Java EE 5 onwards everything is simplified. All the features like (IOC,DI,AOP, Persitence,Transcation) is available in EE5 and onwards. For persistence EJB3/JPA performs better than Hibernate for large volume of data.

My question is then why we need Spring or benefits of Spring over Java EE5?
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1383
Spring do not need Application Server, just servlet contaner is enough
EJB needs EJB container(part of application server)
Debopam Poddar
Ranch Hand

Joined: Jun 21, 2005
Posts: 51

Just because Application server is required we shouldn't consider EJB? no other reasons ??? There are free industry satandard App server available, so cost is also not involved. So in that case EJB can be used instead of Spring.

What about scalability and thorughput?
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

For persistence EJB3/JPA performs better than Hibernate for large volume of data.

I don't think this is true. Hibernate implements EJB3.x spec. So saying EJB3.x performs better than Hibernate is plainly wrong. In term of performance, it all drills down to the JPA providers, e.g. OpenJPA, Hibernate, TopLink, etc.

To me, JavaEE 5 is half-baked spec. If you look at it more closely, there are a lot of things that are missing in JavaEE 5, for example, in JPA, you don't see any query by criteria. This is solved in JPA 2.0 (part of JavaEE 6). Support for dependency injection isn't there in JavaEE 5. In JavaEE 6, it's called CDI (Context Dependency Injection). JavaEE 5 only supports limited number of transaction types whereas Spring has a lot more transaction types in addition to the standard JavaEE transaction types. I can go on with this, but the point is that Spring offers a lot more than what JavaEE 5 can provide. I also understand that most of the issues above have been solved in JavaEE 6 The current adoption of JavaEE 6 is still pretty low since there aren't many certified JavaEE 6 app servers available yet.

So now the question is which one to choose. That depends on your needs. There is no such a thing as best framework.

If you look at the number of Spring modules, you'll see that most of the things, e.g. Spring AOP, Spring OSGi, Spring Batch, etc aren't available in JavaEE 5. I guess if you look at Spring only as an IoC container and ignore all the modules that it has, it kinda defeats the purpose of using Spring. After all, one beauty of Spring is that it's able to glue a lot of frameworks seamlessly

My 0.02c.

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

What about Spring MVC. Does it score over JEE web applications ?

Spring has lot of extra things like JDBC , JMS, Hiberbate, ibatis templates which reduces boiler plate code. I am not sure if JEE provides the same. Spring has remoting APIs which makes it eaiser to invoke/setup remote application using protocols like Burlap.

Yes performance of app depends on what you chosen.

I agree. Here's the link:
subject: Why Spring ?