|
@@ -41,22 +41,22 @@ public class PropertiesUtil {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 初始化方法
|
|
|
|
|
|
+ * 加载配置文件
|
|
*
|
|
*
|
|
* @author WANGWEI
|
|
* @author WANGWEI
|
|
* @param resourceName
|
|
* @param resourceName
|
|
*/
|
|
*/
|
|
public static void loadFromResource(String resourceName) {
|
|
public static void loadFromResource(String resourceName) {
|
|
- load(PathUtil.getResoucePath(resourceName));
|
|
|
|
|
|
+ loadFromPath(PathUtil.getResoucePath(resourceName));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 加载配置文件并观察配置文件
|
|
|
|
|
|
+ * 加载配置文件
|
|
*
|
|
*
|
|
* @author WANGWEI
|
|
* @author WANGWEI
|
|
* @param path
|
|
* @param path
|
|
*/
|
|
*/
|
|
- public static synchronized void load(String path) {
|
|
|
|
|
|
+ public static synchronized void loadFromPath(String path) {
|
|
if (StringUtils.isBlank(path)) {
|
|
if (StringUtils.isBlank(path)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -75,33 +75,6 @@ public class PropertiesUtil {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @param path
|
|
|
|
- * @param props
|
|
|
|
- */
|
|
|
|
- public static void loadFromDir(String path, Properties props) {
|
|
|
|
- File dir = new File(path + "");
|
|
|
|
- if ((!dir.exists()) || (!dir.isDirectory())) {
|
|
|
|
- LOG.error("directory [" + path + "] is illegal.");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- LOG.info("Loading all Properties files from path [" + path + "].");
|
|
|
|
-
|
|
|
|
- File[] files = dir.listFiles();
|
|
|
|
- if (null == files || 0 == files.length) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- for (File file : files) {
|
|
|
|
- if (file.isDirectory()) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if (file.getName().toLowerCase().endsWith(".properties")) {
|
|
|
|
- loadFromFile(file, props);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* @param resourceName
|
|
* @param resourceName
|
|
* @param props
|
|
* @param props
|