接口 public interface Cc { void say(); } 实现类: public class C implements Cc{ @Override public void say() { System.out.println("good"); } } 代理类: public class ProxyTest implements InvocationHandler { //真实对象 private Cc targent; public Cc getPerson(Cc targent){ this.targent=targent; Class<?> clazz=targent.getClass(); return (Cc) Proxy.newProxyInstance(clazz.getClassLoader(),clazz.getInterfaces(),this); } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object obj = method.invoke(this.targent, args); return obj; } } 测试结果: ProxyTest proxyTest=new ProxyTest(); //只对Cc接口进行代理 Cc cc = proxyTest.getPerson(new C()); cc.say();