【问题标题】:Can you help me understand the purpose of java:comp/env (The Enterprise Naming Context aka ENC)?你能帮我理解 java:comp/env (企业命名上下文又名 ENC)的目的吗?
【发布时间】:2012-09-06 16:30:37
【问题描述】:

我一直在阅读有关 JBoss 命名服务 JNDI 提供程序的信息。

我在代码中看到过一百万次但我从未真正真正理解过的东西——ENC。

// Obtain the application component's ENC
Context iniCtx = new InitialContext();
Context compEnv = (Context) iniCtx.lookup("java:comp/env");

我从

阅读了一些关于 ENC 的信息

Stackoverflow article with an answer that describes ENC a bit

J2EE and JNDI - The Application Component Environment

Another Stackoverflow article

但是,我真的很难理解何时以及为什么要使用 java:comp/env JNDI 上下文。谁能帮我分解一下?

【问题讨论】:

    标签: java jndi


    【解决方案1】:

    ENC 的目的是提供一个隔离的、只读的命名空间,应用程序组件可以依赖该命名空间,而不管组件部署的环境类型如何。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-11
      • 1970-01-01
      • 2016-03-15
      • 1970-01-01
      相关资源
      最近更新 更多