java 读取配置文件

public class ApplicationProperty {
    private final Properties prop = new Properties();
    private static ApplicationProperty instance = null;
    private ApplicationProperty(){}
    public static synchronized ApplicationProperty getInstance(){
        if (instance == null){
            instance = new ApplicationProperty();
            return instance;
        } else {
            return instance;
    public Properties getProperty(){
        try {
            InputStream in = this.getClass().getClassLoader().getResourceAsStream("");
//            System.out.println(in.toString());
        } catch (Exception e){
        return this.prop;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.