Is it possible to programatically bind a JNDI resource to a specific context? I think InitialContext.bind() binds the resource globally (it is visible to all the webapps). I want the resource to be visible only to a specific webapp. I am using tomcat.
This is possible in a lifecycle component in Tomcat, not from the webapp itself but declared in context.xml
. Here is an example and here the declaration.