O'Reilly logo

Java 9 Programming By Example by Peter Verhas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dynamic proxy-based AOP

Spring AOP, when first presented to Java programmers, seems like magic. How does it happen that we have a variable of classX and we call some method on that object, but instead, it executes some aspect before or after the method execution, or even around it, intercepting the call

The technique that Spring does is called dynamic proxy. When we have an object, which implements an interface, we can create another object—the proxy object—that also implements that interface, but each and every method implementation invokes a different object called handler, implementing the JDK interface, InvocationHandler. When a method of the interface is invoked on the proxy object, it will call the following method on the handler object: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required