ConfigurationManager.java
1003 Bytes
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
32
33
34
35
36
37
38
package com.glsk.conf;
import java.io.InputStream;
import java.util.Properties;
public class ConfigurationManager {
private static Properties prop = new Properties();
static {
try {
InputStream in = ConfigurationManager.class.getClassLoader().getResourceAsStream("application.properties");
prop.load(in);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static String getProperty(String key) {
return prop.getProperty(key);
}
public static Integer getInteger(String key) {
return Integer.valueOf(prop.getProperty(key));
}
public static Boolean getBoolean(String key) {
return Boolean.valueOf(prop.getProperty(key));
}
public static Long getLong(String key) {
return Long.valueOf(prop.getProperty(key));
}
public static void main(String[] args) {
System.out.println(ConfigurationManager.getProperty("mysql.url.dj_smartcarlife"));
}
}