liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.apache.ibatis.thread;
 
import java.util.Properties;
 
public class PropertiesUtil {
 
    private static String filename = "/mybatis-refresh.properties";
    private static Properties pro = new Properties();
    static {
        try {
            pro.load(PropertiesUtil.class.getResourceAsStream(filename));
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Load mybatis-refresh “"+filename+"” file error.");
        }
    }
 
    public static int getInt(String key) {
        int i = 0;
        try {
            i = Integer.parseInt(getString(key));
        } catch (Exception e) {
        }
        return i;
    }
 
    public static String getString(String key) {
        return pro == null ? null : pro.getProperty(key);
    }
 
}