这是我的解决方案。
String path = getClass().getProtectionDomain().getCodeSource().getLocation().getFile();boolean onWar = path.contains("WEB-INF");
这是我的解决方案。
String path = getClass().getProtectionDomain().getCodeSource().getLocation().getFile();boolean onWar = path.contains("WEB-INF");