讀取springboot項目resources目錄下自定義properties文件
在resources目錄下建立ok.properties文件
在ok.properties文件有屬性ok=1
讀取該文件的ok屬性值
public class Test{
private static String ok;
public static String getOk() throws Exception {
Properties properties = new Properties();
properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("ok.properties"));
asMaster = properties.getProperty("ok");
return ok;
}
}