Conceptually, a singleton bean is rather simple to understand. However, in certain situations, this unsuspecting class could transpire to days of debugging.

Image for post
Image for post
Beanful photo by https://unsplash.com/@hansripa

A Spring bean. Sounds relatively harmless, doesn’t it? What if I told you that this could be the source of many headaches in web servers, especially if you are new to Spring development. However, if you’re a more seasoned Java developer, then you would be aware of the restless nights debugging your code for hours only to discover that the dreaded bug was a race condition.

What is a Race Condition?

In short, a race condition is when we have simultaneous access from multiple threads/processes on the same resource without some mechanism to process the requests synchronously. …

About

Stanley Lim

Software Engineer at Amazon (AWS). Taking life one step at a time.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store