Dynamic proxy 动态代理
Befor talking about runtime weaving, let's take a look at Java dynamic proxy.
在说运行时织入之间,我们先看看java动态代理
public class DynamicProxyTest { public interface Vehicle { void whistle(); } public static class Boat implements Vehicle { @Override public void whistle() { System.out.println( "Boat whistle!" ); } } public static class VehicleHandler implements InvocationHandler { private Object proxied; public VehicleHandler(Object proxied ) { this.proxied = proxied; } public Object invoke(Object proxy, Method method, Object[] args ) throws Throwable { checkVehicle(); return meth