读取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;
}
}
版权声明:本文为qq_35337467原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。