type1 接口注入
我们常常借助接口来将调用者与实现者分离。如:
public class classa {
private interfaceb clzb;
public init() {
ojbect obj =
class.forname(config.bimplementation).newinstance();
clzb = (interfaceb)obj;
}
……
}
public class dibyconstructor
{
private final datasource datasource;
private final string message;
public dibyconstructor(datasource ds, string msg)
{
this.datasource = ds;
this.message = msg;
}
……
}
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器