This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB3 Dependency Injection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB3 Dependency Injection" Watch "EJB3 Dependency Injection" New topic
Author

EJB3 Dependency Injection

Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
With Spring it's easy to understand, I configure the remote object putting the ip and the name for look-up, and Spring do the injection for me.
But with EJB3, I just use @EJB annotation in a field and the EJB is injected. So the question is, how it work's? And, can I configure a different server for EJB look-up.


thank's.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Yes you can.

Basically the Annotations have "smart" defaults, so in that basic case the object reference type in your code tells the App Server which bean to inject. If there are differences betweent the reference type, or if it has to look it up in a remote app server, then you will include attributes to the @EJB to tell it where to find it. It is called only configuring to the exception. So you only have to put more stuff in there if you have to be different than the smart defaults.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB3 Dependency Injection