• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Questions about DI and JNDI ref  RSS feed

 
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
 
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
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!