我编写了一个客户端来将 EJB 部署在 JBoss 中。我参考了互联网上的例子。几乎所有这些都使用 Properties 类来定义 URL 和初始上下文工厂。我想知道为什么属性比哈希表更受欢迎,因为我们没有将它存储到文件或从中读取?互联网上的一个样本是 -
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
props.put(Context.PROVIDER_URL, "file:///");
// Create the initial context from the properties we just created
Context initialContext = new InitialContext(props)