π‘ Lesson Learned — Not a Prod Bug, But a Real Pain No, this wasn’t a production outage. Nobody screamed at me. But I sat for 3 hours wondering: “Why the heck is my @Transactional not rolling back!?” π΅π« “Why is Redis cache not working?” π€― Turned out, the issue was one silent villain: π§± Self-invocation π€· What Is @Transactional ? If you're new: @Transactional = Tells Spring to start a DB transaction when a method is called. It’ll commit if everything’s okay. It’ll rollback if something fails. π§ Think of it like wrapping your code in: try { beginTransaction(); // your logic commit(); } catch(Exception e) { rollback(); } π΅️ Real-Life Analogy — The Gateway Community π️ Let me tell you about my society — it has a strict watchman at the gate. Here’s how it works: π Watchman = Spring Proxy π Your apartment = Your service class πͺ Your room = A method inside that class π Scenario 1: Outsider Visits Your friend from outside...
A cozy space where I share my daily Java learnings, issues, and solutions.