[jboss-user] [EJB 3.0] - Re: Lookup EJB via JNDI
hipa
do-not-reply at jboss.com
Thu Aug 28 01:55:57 EDT 2008
I can't modify bean that I want to lookup.
| @Local
| public interface LookupBeanLocal
| {
| public Object lookup(String name);
| }
|
| @Stateless
| public class LookupBean implements LookupBeanLocal
| {
| public Object lookup(String name)
| {
| // Here I need to get bean with name 'name'
| }
| }
|
Then in other bean I want to get bean by name like @EJB annotation can do:
| @Stateless
| public class MyBean implements MyBeanLocal
| {
| @EJB
| private LookupBeanLocal lookupBean;
|
| @EJB(name = "MyBean")
| private MyBeanLocal myBean;
|
| public void test()
| {
| MyBeanLocal me = (MyBeanLocal) lookupBean.lookup("MyBean");
| assert myBean.equals(me);
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4172952#4172952
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4172952
More information about the jboss-user
mailing list