This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.
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
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
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.