• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Vs EJB

 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Thanks
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes you think "Spring is a very good competitor to EJB"?
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a very good framework for Component Based developments
 
Alexandre Portugal
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic