Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Spring Vs EJB

 
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
 
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
 
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.
 
Do not set lab on fire. Or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic