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?
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.