diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4c9c1a9..61a0ff1 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,12 @@ - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + @@ -96,6 +113,7 @@ + @@ -253,16 +271,15 @@ - - @@ -273,11 +290,11 @@ - + - + @@ -359,6 +376,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/cn/edu/hust/conf/ConfigurationManager.java b/src/main/java/cn/edu/hust/conf/ConfigurationManager.java new file mode 100644 index 0000000..355ca0d --- /dev/null +++ b/src/main/java/cn/edu/hust/conf/ConfigurationManager.java @@ -0,0 +1,38 @@ +package cn.edu.hust.conf; + +import java.io.InputStream; +import java.util.Properties; + +/** + * 配置文件管理类 + * 主要的功能:从特定的properties文件中读取相应的key/value + */ +public class ConfigurationManager { + private static Properties prop=new Properties(); + + /** + * 通过静态代码块加载配置文件 + */ + static{ + try + { + //通过类的加载器读取配置文件 + InputStream is=ConfigurationManager.class.getClassLoader().getResourceAsStream("conf.properties"); + //加载配置文件 + prop.load(is); + }catch(Exception e) + { + e.printStackTrace(); + } + } + + /** + * 通过指定的key获取value + * @param key + * @return + */ + public static String getProperty(String key) + { + return prop.getProperty(key); + } +}