我一直在阅读有关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
但是我真的很难理解何时以及为什么要使用java:comp / env JNDI上下文。任何人都可以为我分手吗?
答案 0 :(得分:1)
ENC的目的是提供一个独立的只读命名空间,应用程序组件可以依赖该命名空间,而不管部署该组件的环境类型如何。