[jboss-user] [EJB3] - Re: 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?

Viggo Navarsete do-not-reply at jboss.com
Fri Jun 22 03:07:59 EDT 2012


Viggo Navarsete [https://community.jboss.org/people/viggo.navarsete] created the discussion

"Re: 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/743572#743572

--------------------------------------------------------------
Yes, you're correct! Whenever a new instance of PrimaryStatelessBean is created by the EJB container (and since it's a stateless annotated bean, you will get a new one for each request), then you will get injected a new instance of SecondaryStatelessBean (since it's most likely also a stateless annotated bean, based on your naming convention), and you will get access to the *one instance* of SimpleSingletonBean that has been created by the EJB container (since it's a Singleton annotated bean).
--------------------------------------------------------------

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

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/b8fd4e11/attachment.html 


More information about the jboss-user mailing list