如何识别应用程序在 WebLogic 上是 运行 还是 JBoss?

How to identify if an application is running on WebLogic or JBoss?

基于哪个应用实例 运行(如 WebLogic 或 JBoss),我必须获取 IP,它映射到不同的 header。那么,如果 Web 应用程序在 WebLogic 上是 运行 或 JBoss?

,我该如何以编程方式识别 Java

您可以尝试获取 jboss.server.name 系统 属性(这样您就知道您的应用 运行 在 JBoss 容器中)和 weblogic.Name一个(对于 WebLogic 版本)。

例如

String weblogicServerName = System.getProperty("weblogic.Name");
String jbossServerName = System.getProperty("jboss.server.name");

一组标识您的容器。