@@ -0,0 +1,1316 @@
+import java.lang.reflect.InvocationHandler;%0Aimport java.lang.reflect.Method;%0Aimport java.lang.reflect.Proxy;%0A%0A/**%0A * Created by mazhuang on 2017/3/14.%0A */%0A%0Ainterface Human %7B%0A    void eat();%0A    void sleep();%0A%7D%0A%0Aclass Student implements Human %7B%0A    @Override%0A    public void eat() %7B%0A        System.out.println(%22Student eat%22);%0A    %7D%0A%0A    @Override%0A    public void sleep() %7B%0A        System.out.println(%22Student sleep%22);%0A    %7D%0A%7D%0A%0Aclass HumanProxyHandler implements InvocationHandler %7B%0A%0A    private Human mBase;%0A%0A    public HumanProxyHandler(Human base) %7B%0A        mBase = base;%0A    %7D%0A%0A    @Override%0A    public Object invoke(Object proxy, Method method, Object%5B%5D args) throws Throwable %7B%0A%0A        System.out.println(%22Before invoke %22 + method.getName());%0A%0A        Object result = method.invoke(mBase, args);%0A%0A        System.out.println(%22After invoke %22 + method.getName());%0A%0A        return result;%0A    %7D%0A%7D%0A%0Apublic class DynamicProxyTest %7B%0A    public static void main(String%5B%5D args) %7B%0A        Student student = new Student();%0A        HumanProxyHandler proxyHandler = new HumanProxyHandler(student);%0A        Human proxy = (Human) Proxy.newProxyInstance(%0A                Human.class.getClassLoader(),%0A                new Class%5B%5D %7BHuman.class%7D,%0A                proxyHandler);%0A        proxy.eat();%0A        proxy.sleep();%0A    %7D%0A%7D%0A

add dynamic proxy test