Jun 13th, 2009, 08:05 AM
EJB3 vs SpringFramework
An interviewer said that SpringFramework is more advantageous than EJB 2 while EJB 3.0 has a great improvement. He asked me what are the advantages of EJB 3.0 over SpringFramework.
I do not think EJB and SpringFramework are mutual exclusive. They are an apple and an orange. How can we compare them?
Jun 18th, 2009, 07:38 AM
EJB3 comes with clustered remoting and distributed transaction capabilities out of the box. On the other hand, clustering is (afaik) not a part of the spec, it's just the implementation. Other then that, I'd say that there are no advantages.
As a proof of concept I created an EJB3 look-alike containter using Spring + JNP + JBoss-Remoting in a couple of hours. From outside it looks like a JBoss server, you can make JNDI lookups and get remote stubs that look and feel like EJB3 stubs.
Jun 18th, 2009, 09:37 AM
EJB3 has made a step towards IoC. So comparable features would be injecting dependencies, transaction management, remoting capabilities (at least thats what comes to my mind right now).
The IoC-capabilities of EJB3 are inferior in comparison to Spring. Concerning transactions, Spring pretty well sticks to the standard, but has some nice extensions here, too. In remoting Spring provides more possibilities while EJB3 is stronger towards clustering (as already stated by dejanp). Also EJB3 supports distributed transaction which Spring does not. But I do not think that this is a very desirable feature to have.
That said, I agree to your statement that EJB3 and Spring are not mutually exclusive. As of comparing them: maybe not in whole, but some common features are indeed comparable.
Jul 6th, 2009, 06:49 PM
You can also take a look at the source code, you will realize it is meant to make working with EJB's easier. I've only got as far as incorporating it into my architecture but only did the config for local, not remote beans. It was very good though and they had liked it..
Dec 15th, 2009, 03:38 PM
Spring an EJB Lite Container in the next future
does anybody know if spring will be one implementation of EJB Lite, part of the JEE 6 specification? In my opinion it will go the same way as Hibernate did with JPA, just being one implementation.
Any cross references are welcome.