File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Spring Vs EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Spring Vs EJB" Watch "Spring Vs EJB" New topic

Spring Vs EJB

Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 404
Hi Friends,

As all of you know Spring is a very good competitor to EJB.

My question is does Spring support concurrency?

Because Spring encourages to configure Spring beans as Singletons. With Singleton Services (Spring Beans) how spring handles concurrency? If spring doesnt support concurrency how it became a competitor to EJB?

Comments are warmly welcome

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
What makes you think "Spring is a very good competitor to EJB"?
Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 404
Its a very good framework for Component Based developments
Alexandre Portugal

Joined: Jul 11, 2008
Posts: 11
Spring does support concurrency. But, contrarily to EJB, it doesn't take for granted that you actually need such support. In other words, it's up to you to choose the solution for your concurrency problem:

a) Maybe your business objects are thread-safe and simply don't need any concurrency control. Spring "encourages you to configure beans as Singletons" in this case.

b) Maybe your bo's are not initially thread-safe, but you want to turn them thread-safe using Java synchronization mechanism.

c) Maybe you don't want to bother yourself with synchronization code. You can then use the Spring �prototype� approach, which creates a new instance of your business objects for each thread. Spring even offers instance pooling for this case.
I agree. Here's the link:
subject: Spring Vs EJB
It's not a secret anymore!