java静态方法中读取某个配置文件中的配置
java静态方法中读取某个配置文件中的配置
注意:
application-dev.yml 配置文件名称
accout 配置文件中配置项key
public static void main(String[] args) throws IOException {
Properties props = new Properties();
InputStream inputStream= ElectronicWhr.class.getClassLoader().getResourceAsStream("application-dev.yml");
props.load(inputStream);
String value = props.getProperty("accout");
System.out.println("accout" + "=" + value);
}
还没有评论,来说两句吧...