java获取properties配置文件值
配置文件位置src/config/resource/ftp.properties
获取配置文件内容值方法
public static String getFtpKey(String key){
ResourceBundle resource = ResourceBundle.getBundle(“config/resource/ftp”);
return resource.getString(key);
}
ps:(key传入配置文件里写的值)
例:ftp.properties里面的内容
要获取ftp.host
调用getFtpKey(“ftp.host”)。
还没有评论,来说两句吧...