`

读 properties

 
阅读更多
public class PropUtil {

    private static String getKey(String key){
        Properties properties = new Properties();
        InputStream inputStream = PropUtil.class.getClassLoader().getResourceAsStream("system.properties");
        System.out.println(inputStream);
        try {
            properties.load(inputStream);
        } catch (IOException e) {
            e.printStackTrace();
        }
        String value  = properties.getProperty(key);
        return value;
    }

    public static void main(String[] args) {
//        System.out.println(getKey("appServerIp"));

        ResourceBundle resource = ResourceBundle.getBundle("system");
        System.out.println(resource.getString("appServerIp"));
    }
}

 

 https://blog.csdn.net/mhmyqn/article/details/7683909

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics