How to put(bind) object to jndi in spring declaratively?

Your can create a JndiExporter which uses a JndiTemplate to bind a map of object with a name.

Your can create a JndiExporter which uses a JndiTemplate to bind a map of object with a name: Your JndiExporter have to implements BeanFactoryAware to retrieve the spring bean with the injected BeanFactory. This is one possible may :).

Yes, did so already, seems it works fine ) But just curious a bit why there is no such helper in spring, only multiple jndi lookups ways. – yetanothercoderu May 12 at 10:03.

There is no standard or best practices type approach for this problem. You will have come with with your own approach. Following is the another approach which can take care of your problem.

Make javax.naming. InitialContext a spring bean (say initialContext). Make sure you pass it a appropriate map of initial properties as required.

Now create another bean say JndiBinder. Inject the bean mentioned #1 above in this bean. This bean will take a map of jndi-names and corresponding objects.

For your case, the object will be datasource, already available in spring context. In the JndiBinder bean definition, write a init-method which would call bind menthod of initialContext for all the entries in the map (of jndi-names and corresponding objects). This way all the entries in the map supplied are bound to JNDI tree.

This is essentially what I did in my solution to this problem: stackoverflow. Com/questions/4414115/spring-as-a-jndi-provider – Polaris878 May 12 at 18:54.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions