【Java】读取properties配置文件的方法

来源:互联网 发布:115 mac会员破解版 编辑:程序博客网 时间:2024/05/29 09:12

配置文件存在于resource 目录中,名称为:service.properties

里面的内容是:

VerifyUrl=http://localhost:8080/user/verify

使用时,拿到配置文件 ,VerifyUrl的 地址

ResourceBundle resource = ResourceBundle.getBundle("service"); // 配置文件的文件名
String path = resource.getString("VerifyUrl");  // 想拿的key

原创粉丝点击