java读取配置文件

package org.inspur.crm_pw.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


public class ReadConifg {
	Properties property = new Properties();
	InputStream in = this.getClass().getClassLoader().getResourceAsStream("crmConfiger.properties");
	{
		try{
			property.load(in);
		}catch (IOException e){
			e.printStackTrace();
		}
	}
	public String getSinglePointAddr(){
		return property.getProperty("singlePoint");
	}
	public String geturlPrefix(){
		return property.getProperty("urlPrefix");
	}
	public static void main(String args[]){
		ReadConifg rt = new ReadConifg();
		System.out.println(rt.getSinglePointAddr());
	}
}

 

你可能感兴趣的:(java)