-
Proxies the Native Way: JDK Dynamic Proxies
Welcome back to our series on Java Proxies! If you’ve been following along, we’ve already discussed the conceptual how and why of the Proxy Pattern, learned how to write a static proxy, introduced the idea behind dynamic proxies, and looked at how some of the Java giants like Spring, Hibernate, and Mockito use dynamic proxies…
-
Magic in the Wild: How Java Giants like Spring, Hibernate, and Mockito use Dynamic Proxies
Welcome to the second installment of the series: Java Proxies Unmasked. In the previous post, we learned about the classic Proxy pattern. We built a Static Proxy and realized that while it works for a simple example, it doesn’t scale. Nobody wants to write a static proxy for every relevant class in their codebase. We…
-
Understanding Proxy Patterns: The Why and How of Static and Dynamic Proxies in Java
In the previous post, we talked about Spring’s @Transactional annotation, and saw how it does its magic with Spring AOP, thanks to the unsung hero working behind the scenes: dynamic proxies. That got me thinking: why stop there? Proxies are used all the time in Spring, so why not do a deeper dive under the…
-
The Proxy Paradox: Why Spring @Transactional Vanishes
We’ve all been there. You annotate @Transactional on a critical method in your Spring application, run mvn test, watch the green checkmarks fly by, and feel good about yourself. Everything’s going swell innit? But then you open the transaction log and find… nothing. Where did your transaction go? No connection enlisted. No timeout. No rollback…
-
The Dependency Injection Dilemma: Why I’m Finally Ghosting @Autowired on Fields
In the world of Spring Boot development, we are often seduced by “magic.” We love the annotations that make 50 lines of boilerplate vanish. We love the auto-configuration that “just works.” And for a long time, the poster child for this magic was the @Autowired annotation sitting snugly atop a private field. It looks clean, it’s remarkably…