It looks like another Java EE vs. Spring post ...
EJB / Java EE and Spring are now two mature, competitive Java technology packages. Often there is no reason to complicate things and mix them. EJB really learned and used many ideas from Spring et al.
None of them lead you into an XML / configuration addon. Both are pretty easy to start with, at least from the element itself.
Spring is more than just IoC / SOA / transactions. This is more like a toolbar - it is ready to integrate or directly provides the infrastructure for ORM and transactions, web / MVC, security, timers / scheduling, etc. You can choose exactly the parts that you need. You should not use the container (you can use it in your standalone "desktop").
EJB is part of the Java EE stack. This is, well, standard. It is not as wide, flexible as Spring, but by definition it is supported by all Java EE containers.
I prefer Spring for freedom and one step ahead.
source share