EJB 3.0注入(会话BEAN)[Java编程]
本文“EJB 3.0注入(会话BEAN)[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
按照管理 来看看 例子 就清楚了
这个是一个实体bean的实现
package com.ly.bean;
import javax.ejb.Remote;
@Remote
public interface Bean1 {
public void sayBean1();
}
package com.ly.bean;
import javax.ejb.Remote;
@Remote
a public interface Bean2 {
public void sayBean2();
}
package com.ly.bean;
import javax.ejb.Remote;
@Remote
public interface Bean3 {
public void sayBean3();
}
package com.ly.impl;
import javax.ejb.Stateless;
import com.ly.bean.Bean1;
import com.ly.bean.Bean2;
@Stateless(name="bean12")
public class Bean1Impl implements Bean1,Bean2 {
public void sayBean1() {
System.out.println("bean1.........");
}
public void sayBean2() {
System.out.println("bean2.........");
}
}
package com.ly.impl;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import com.ly.bean.Bean1;
import com.ly.bean.Bean2;
import com.ly.bean.Bean3;
@Stateless(name="bean3")
public class Bean2Impl implements Bean3 {
@EJB(beanName="bean12")
Bean1 bean1;
Bean2 bean2;
public void sayBean3() {
bean1.sayBean1();
bean2.sayBean2();
System.out.println("bean3.........");
}
@EJB(mappedName="bean12/remote")
public void setBean2(Bean2 bean2) {
this.bean2 = bean2;
}
}
以上是“EJB 3.0注入(会话BEAN)[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |