#aop
Posts
-
Digging into Spring's Source 10: How an AOP Proxy Gets Built — the JDK Way and the CGLIB Way
How a single ProxyFactory.getProxy() call decides between a JDK dynamic proxy and a CGLIB proxy, how each one is built, and how a call on the proxy travels through the interceptor chain to the target object — all checked against the real source. Also why calling your own method from inside the class skips the advice, and the trap with final methods, shown with runnable examples.
-
Digging into Spring's Source 11: How @Aspect Gets Discovered and How the Advice Chain Runs
What the single line @EnableAspectJAutoProxy registers in the container, how an @Aspect class is turned into advisors, how the container decides which beans to wrap in a proxy, and in what order @Around, @Before, @After, @AfterReturning and @AfterThrowing run when a proxied method is called — all checked against the real source and real example output.
-
Digging into Spring's Source 17: @Transactional — Who Opens a Transaction and Who Closes It
Put @Transactional on a method and somebody opens a transaction, rolls it back on an exception and commits it otherwise — this post follows who that somebody is, in the real source. The three interfaces PlatformTransactionManager, TransactionDefinition and TransactionStatus, the beans that @EnableTransactionManagement registers, the order in which TransactionInterceptor wraps a call, where propagation branches, why the connection is bound to a ThreadLocal, and traps such as "checked exceptions do not roll back" and "the outer method gets an UnexpectedRollbackException when the inner one fails", all checked with examples.