package cn.him.userdao;
//创建代理接口
public class Proxy implements UserManager {
private UserManager userManager;
//通过构造函数注入真实角色UserManagerImpl
public Proxy(UserManagerImpl ul){
userManager = ul;
}
@Override
public void addUser() {
System.out.println("proxy before");
//输出实现类add方法值
userManager.addUser();
System.out.println("proxy end");
}
@Override
public void updateUser() {
// TODO Auto-generated method stub
}
}
转载于:https://my.oschina.net/u/1861920/blog/644975