Spring - Why Spring Bean is Singleton

Why Spring Bean is default Singleton ?

  • Stateless Bean rules is the reason for that.   
  • .If you not going to hold the state data in beans then its enough to have only one instance of each bean.
  • And when the service is stateless its thread safe.
  • So spring have only stateless bean.
Eg: Connection of Database . 

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab