游戏后台开发
分类: Java
2013-11-20 17:51:37
类型 1 | 服务需要实现专门的接口,通过接口,由对象提供这些服务,可以从对象查询依赖性(例如,需要的附加服务) |
类型 2 | 通过 JavaBean 的属性(例如 setter 方法)分配依赖性 |
类型 3 | 依赖性以构造函数的形式提供,不以 JavaBean 属性的形式公开 |
BeanFactory factory = new XMLBeanFactory(new FileInputSteam("mybean.xml")); |
MyBean mybean = (MyBean) factory.getBean("mybean"); |
public interface CreditRatingInterface { public boolean getUserCreditHistoryInformation(ICustomer iCustomer); } |
public interface CreditLinkingInterface { public String getUrl(); public void setUrl(String url); public void linkCreditBankAccount() throws Exception ; } |
public interface EmailInterface { public void sendEmail(ICustomer iCustomer); public String getFromEmail(); public void setFromEmail(String fromEmail) ; public String getPassword(); public void setPassword(String password) ; public String getSmtpHost() ; public void setSmtpHost(String smtpHost); public String getUserId() ; public void setUserId(String userId); } |