我怀疑 ServletContext 是每个 Web 应用一个,每个 JVM 一个。但是如果我在同一个 JVM 上运行多个 Web 应用程序。然后每个 JVM 有 2 个 ServletContext。可能吗?有人可以详细说明一下吗?
最佳答案
每个 webapp 都有自己的 ServletContext。的方式api docs把它是:
There is one context per "web application" per Java Virtual Machine. (A "web application" is a collection of servlets and content installed under a specific subset of the server's URL namespace such as /catalog and possibly installed via a .war file.)
“每个 Web 应用程序”部分意味着如果您在集群中设置应用程序,那么集群中的每个节点都有一个单独的 JVM,并且 JVM 将运行所有应用程序的单独副本,包括每个应用程序的 ServletContext网络应用程序。
关于java - ServletContext 是每个 Web 应用程序一个还是每个 JVM 一个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2191379/