[jboss-user] [EJB3] - How does a @EJB dependency injection work on a Stateless Bean? Will that injected class behave like an instance variable in that stateless session bean?

Adheep M do-not-reply at jboss.com
Fri Jun 22 01:14:59 EDT 2012


Adheep M [https://community.jboss.org/people/adheep] created the discussion

"How does a @EJB dependency injection work on a Stateless Bean? Will that injected class behave like an instance variable in that stateless session bean?"

To view the discussion, visit: https://community.jboss.org/message/743539#743539

--------------------------------------------------------------
Hi guys,

I have this question on the latest  version EJB 3.1 has the "@EJB" annotation which is used for the dependency injection.
I have two stateless session bean and a singleton bean

@Stateless
public class PrimaryStatelessBean {
 
     @EJB
     SecodaryStatelessBean secondaryStatelessBean;
 
     @EJB
     SimpleSingletonBean simpleSingletonBean;
 
     public String processRequest ( ) {
          
          .....
          secondaryStatelessBean.getValue();
          simpleSingletonBean.getAnotherValue();
          ....
     }
 
}

How does the @EJB annotation work, will the injected class behave like an Instance variable of the PrimaryStatelssBean ?  :-/
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/743539#743539]

Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120622/d6ff7ede/attachment.html 


More information about the jboss-user mailing list