public class Action
{
public void execute()
{
ICustomerDao cdao = DaoFactory.getBean("类名");
cdao.login();
}
}
public class BeanFactory
{
public static Object getBean(String className)
{
return Class.forName(className).newInstance();
}
}
public interface ICustomerDao()
{
public abstract boolean login();
}
public class CustomerDao implements ICustomerDao
{
pbulic boolean login(){/*代码*/}
}