Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

javax.naming.Context & Spring.

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I'm trying to make a spring service which will run at the end on Websphere (& Hibernate). The way I currently see how it should work is: retrieve a certain jndi lookup string (indicating the environment for which this Websphere instance is running) and using this string to retrieve some databasae stored settings (per environment).
I'm currently trying very hard to inject an javax.naming.Context into the service I'm imlementing. Alas till sofar without any luck. Tried the org.springframework.mock.jndi.SimpleNamingContext in the application.xml that worked but that is not a productionsolution I'd say and I found it unintuitive to bind some values to it. The docs say I can pass in a Hashtable but how to specify a hashtable in application.xml is not very clear to me yet.
I'm also starting to wory whether this is the correct approach I'm taking. Or Am I just on a steep learning curve at this moment?
regards jeroen.
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you're trying to do but if you just want to inject something from a jndi lookup, the following definition from the Petclinic sample app shows how to do it. You can then inject that bean in the normal way.

 
Your mind is under my control .... your will is now mine .... read this tiny ad
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!