|
It was 3 am. Cold night. I was in deep sleep. That's when Sarah called me. "Payment service down. It's 500 errors!!" I was terrified. Customers couldn't buy anything. My sleep... just gone. I opened my computer.... Logged on to the server to see what happened. The log showed: ERROR - BeanCreationException: Error creating bean 'paymentProcessor'
ERROR - Could not resolve placeholder 'stripe.api.secret'
I was exhausted. After a loooong week of development, I just wanted to take some rest. but no way... I need to figure out the issue. I just could not understand what is happening! i checked the config: # application-prod.properties
database.password=${DB_PASSWORD}
stripe.api.secret=${STRIPE_SECRET}
everything looked fine. Environment variable were set. I restarted the server....Same error Rolled back....Still broken. I tried by adding one flag to the deployment... java -jar /app/service.jar --debugNow the startup report showed!!! WARNING: ConfigMap 'payment-service-config' Property 'stripe.api.secret' not found AHA š I checked the Kubernetes ConfigMap that DevOps had updated: data:
application.properties: |
database.password=${DB_PASSWORD}
# stripe.api.secret=${STRIPE_SECRET} # Oops!
OOPS!! Someone had accidentally commented it out during the credential change!!! So, I uncommented it. Redployed.... It worked š Service recovered. Downtime 23 Minutes! Now, this time I needed to think about how I can prevent this so that it does not happen in the future? After all, I don't want to sacrifice my sleep at midnight for this. not again.... So I added validator. @ComponentFrom now on, if the app fails, it fails fast with a clear message. Lesson: Use --debug flag. It shows exactly what Spring is doing during startup. Did you face something similar? Please let me know. I want to know your story. Maybe that will save me in the future. All the best Iftekhar Hossain |
Iām Iftekhar ā a developer sharing what I learn about Java, Spring Boot, Spring Security, and related backend technologies like Docker, Kubernetes, and Kafka.Each week, I send one practical email with code examples, mini-projects, and real-world lessons to help you grow as a backend developer.
Monday morning, I was sipping coffee. On my desk. in my office Sarah, along with another Junior Developer, Tom, came to me. "Service works on my laptop. Crashes in staging. Same code. No idea why!" - Said Tom I checked the log. in the staging: ERROR - No qualifying bean of type 'EmailService' available ERROR - expected at least 1 bean which qualifies as autowire candidate But Tom's Local logs: INFO - Started Application in 8.2 seconds INFO - EmailService initialized successfully Same code....
Last mail was about 'How to Use Java Records to Write Better and More Efficient Code'. But Is it really Immutable? Java often receives criticism for being too formal, requiring developers to write a lot of code even for simple tasks. It has some good sides like, it making Java code more readable and at the same time helping the developer to write code that has fewer bugs. In some instances, however, it creates unnecessary overhead. The worst case scenario is when there is a need for a data...
How to Use Java Records to Write Better and More Efficient Code JAVA is one of the most popular and widely used programming languages. In many cases, it is the first choice for enterprise application development. Even now billions of devices are powered by JAVA. If you are reading this article on your Android ā you got it! This is also run by JAVA! Oracle, the company who is responsible for developing and maintaining the JAVA language itself, introduces new features on a regular basis to make...