8 Comments
Jul 2Liked by Ashish Pratap Singh

Wow I am going to take printout of this…. I really appreciate your work…

Expand full comment
Jun 24Liked by Ashish Pratap Singh

great article 🔥🔥

Expand full comment
author

thank you 😊

Expand full comment
Jun 24Liked by Ashish Pratap Singh

Nice article.

Maybe it's worth also mentioning the kotlin way (object keyword and companion) and the spring way(@bean with default scope=singleton)

Expand full comment
author

good point!

Expand full comment
Jun 24Liked by Ashish Pratap Singh

Thanks for sharing bro awaited one🙌🏻🙌🏻

Expand full comment

How Bill pugh is singleton, everytime the helper classes will be loaded, then the instance will be created, right?

Expand full comment
author

the singleton instance is only created the first time helper class is loaded. Subsequent calls to getInstance() return the existing instance since it's declared as static.

Java guarantees that static fields are initialized only once, even in a multi-threaded environment.

Expand full comment