• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions about DI and JNDI ref

 
Ravi Onteru
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I have the following queries related to DI and refering JNDI Names for resources. I would appriciate a detailed explanations to these questions.


1. Can a resource like datasource can be accessed outside the container using JNDI lookup?
2. Why we need to declare the dependency injection at the class level? How container treats this behind the scenes?
3. Since the Global JNDI name(binding name) is verndor specific, what are the best practices of refering to a resource? How these are handled in real time projects?


Many Thanks In Advance,
Ravi
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

1.The answer to the point 1, yes, the JPA can be used outside of the business container.
2.I am not shore what do you mean ?
3.In most of the casses when you use DI you don't need to care about the JNDI names, (globales or not) the container does this. But if you need to access the resources from non managed classes you need to use jndi. In this cases you must map the global to jndi names in order to improve the portability.


Regards,
Mihai
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic