基于JDK的动态代理例子如下 接口 Subject public interface Subject { public abstract void request(); } 实现类RealSubject public class RealSubject implements Subject { @Override public void request() { System.out.println("from realsubjct"); } } 代理类 public class Dyn…
To be, or not to be: that is the question. --<哈姆雷特> 代理模式(Proxy),为其他对象提供一种代理以控制对这个对象的访问. 上代码: package cn.no4.proxy; public interface IMakeMoney { void makeMoney(); } package cn.no4.proxy; public class Proxy implements IMakeMoney { private Boss boss;…