Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reference injection

 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I earlier version of ejb if we want to get reference of another ejb reference then we had to do the look up and get the home object through which he had to get the bean but in new version of ejb do we still have to do the look up or @ejb private some variable will inject the reference?

Thanks in advance
 
Adam Tkaczyk
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Example:

@Stateless
@Local({One.class})
class OneBean implements One{
public void doSmth(){...}
}

@Stateless
@Local({Two.class})
class TwoBean implements Two{

@EJB
private One oneBeanInstance;
public void doSmth2(){...}
}

You have to refer to OneBean class through business interface.
Container will inject implementation of that interface after bean creation and before every invocation of business method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic