简体   繁体   English

JNDI InitialContext null构造函数如何表现?

[英]How does the JNDI InitialContext null constructor behave ?

I saw a stackoverflow answer to a question on JNDI. 我看到了有关JNDI的问题的stackoverflow答案。

The answer showed a few lines of code using InitialContext to retrieve a DataSource. 答案显示了几行使用InitialContext检索数据源的代码。

However, the instance of InitialContext was not created with any properties to use any sort of service such as LDAP or the file system. 但是,没有使用任何属性来创建InitialContext实例以使用任何类型的服务,例如LDAP或文件系统。

Where does the entry go when you bind it to an InitialContext with the null constructor ? 使用null构造函数将条目绑定到InitialContext时,条目会去哪里?

Will the entry only visible within the application ? 条目仅在应用程序中可见吗?

Will it not persist when you shutdown the application ? 当您关闭应用程序时,它不会持续吗?

Where does the entry go when you bind it to an InitialContext with the null constructor? 使用null构造函数将条目绑定到InitialContext时,条目会去哪里?

If there is a resource file named /jndi.properties it uses whatever environment is defined in there. 如果有一个名为/jndi.properties的资源文件,它将使用在那里定义的任何环境。 Servlet containers typically use this to define an extra object factory for the java: namespace. Servlet容器通常使用它来为java:命名空间定义一个额外的对象工厂。

Will the entry only [be] visible within the application? 条目仅在应用程序中可见吗?

Yes. 是。

Will it not persist when you shutdown the application? 当您关闭应用程序时,它不会持续吗?

It will not persist unless the container implements that. 除非容器实现,否则它将不会持久。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM