• 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

Dependency Injection in EJB

 
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
What does it mean when we say that "server looks up the dependency in the environment naming context"?
How server resolves the dependency?

Thanks
 
Bartender
Posts: 2416
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container find the resource or bean by the J.N.D.I names provided by the developer.
 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But a developer can use any name he wishes to.
How does he know that what is the name by which server does a lookup ?

Thanks
 
Himai Minh
Bartender
Posts: 2416
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If we are talking about looking up a bean by its JNDI name, it should be something in this format:


java:global[/application name]/module name/enterprise bean name[/interface name]


where application name is the name of the .ear, module name is the name of .war or .jar file, where bean name is the name of the bean class and interface name is the interface of the bean if any.

reference:http://docs.oracle.com/javaee/6/tutorial/doc/gipjf.html

For environment entries lookup, you define values of environment entries in the deployment descriptor and the bean can inject the values of environment entries using @Resource.
For more example, please refer to Fritz's notes session 7.8
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic