正在加载图片...
Web Technology 2 3 public class Greeting public void greet( public class Greeting public void greet public Speaker s Speaker s= public Greeting (speaker s Speaker s= new (Speaker)context. lookup Speaker() (ejb/Speaker); thiss=s s say Hello(; s sayHello(; public void greet s sayHello( 未使用容器 使用EJB容器 SPR|NG容器 由用户代码控制对象的生命周期 把对象的生命周期和对象间的 关系的控制交给容器Web Technology 11 未使用容器 1 public class Greeting{ public void greet() { Speaker s = new Speaker(); s.sayHello(); } } 使用EJB容器 2 public void greet() { Speaker s = (Speaker)context.lookup ("ejb/Speaker"); s.sayHello(); } SPRING容器 3 public class Greeting { public Speaker s; public Greeting(Speaker s) { this.s = s; } public void greet() { s.sayHello(); } } 由用户代码控制对象的生命周期 把对象的生命周期和对象间的 关系的控制交给容器
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有