venkatesh
№053 · SEP 28, 2026 · 2 MIN READ

3 Spring Annotations I Can Never Forget

3 Spring annotations I can never forget, because they broke in prod.

Three Spring annotations that broke in production

1. @Transactional

I called it from another method in the same class.

Spring wraps the bean in a proxy, like a gate outside it. this.method() walks around the gate.

No transaction, no rollback. The order failed, but the other two tables stayed updated.

Fix: Move the method to another bean or service, so the call goes through the proxy.

2. @Scheduled

Fine on one pod.

On 4 pods, the same cron ran on all of them. Duplicate notifications 💀

Fix: Redis lock + idempotency check. The lock decides who starts, and all the others are blocked.

3. @Lazy

It killed the circular dependency error in 2 minutes.

The same pattern showed up again a week later. It hid the problem instead of fixing it.

Fix: Break the loop with events. ✅

Using an annotation is easy. Understanding how it works is equally important.

copied!