public Object getProxy(final Object target,final Advice advice){
Object proxyObject = Proxy.newProxyInstance(target.getClass().getClassLoader(),
target.getClass().getInterfaces(),
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
//System.out.println(proxy); //为啥不能打印时候出错????
advice.biginMethod();
Object obj=method.invoke(target, args);
advice.endMethod();
return "sjjjjj";
}
});
return proxyObject;
} |