你这应该代理里看到的吧,调用target方法,target是方法名,value应该是该方法的参数

解决方案 »

  1.   

    这是利用java反射原理,调用target实例的method方法,传入value参数。
    method是反射到Test里面的某一个方法,事先定义好,如下:
    @org.junit.Test
    public void test() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, Exception, SecurityException{
    //创建实例
    Test t = new Test();
    //获取方法
    Method method = t.getClass().getDeclaredMethod("print", String.class);

    method.invoke(t,"test");//输出 print: test
    }Test里的方法:
    public void  print(String str){
    System.out.println("print: " + str);
    }