• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB3 Dependency Injection

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic