properties 文件放在WEB-INF的根目录下
<span style="white-space:pre"> </span>Properties properties = null;
String path = PropertyUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath();
path = path.substring(1, path.indexOf("/WEB-INF"))
+ "/WEB-INF/ossoconfig.properties";
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(path));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
properties = new Properties();
try {
properties.load(in);
} catch (IOException e) {
e.printStackTrace();
}
String enableOssoLogin=properties.getProperty("enableOssoLogin");