|
@@ -15,7 +15,6 @@ import org.dom4j.Attribute;
|
|
|
import org.dom4j.Document;
|
|
|
import org.dom4j.Element;
|
|
|
import org.dom4j.io.SAXReader;
|
|
|
-import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
|
import com.persagy.ibms.core.util.ConfigRefresh;
|
|
|
|
|
@@ -500,11 +499,20 @@ public class Constant {
|
|
|
resourc = StrUtil.removePrefix(resourc, File.separator);
|
|
|
}
|
|
|
try {
|
|
|
+ String filePath = File.separator + "usr" + File.separator + "local" + File.separator + "etc" + File.separator + resourc;
|
|
|
+ InputStream stream = ResourceUtil.getStream(filePath);
|
|
|
+ if (stream != null) {
|
|
|
+ log.warn("getStream success 0 " + filePath);
|
|
|
+ return stream;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ try {
|
|
|
// jar包同级config目录
|
|
|
String filePath = System.getProperty("user.dir") + File.separator + "config" + File.separator + resourc;
|
|
|
InputStream stream = ResourceUtil.getStream(filePath);
|
|
|
if (stream != null) {
|
|
|
- log.info("使用1路径{}获取配置{}", filePath, resourc);
|
|
|
+ log.warn("getStream success 1 " + filePath);
|
|
|
return stream;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -514,29 +522,29 @@ public class Constant {
|
|
|
String filePath = System.getProperty("user.dir") + File.separator + resourc;
|
|
|
InputStream stream = ResourceUtil.getStream(filePath);
|
|
|
if (stream != null) {
|
|
|
- log.info("使用2路径{}获取配置{}", filePath, resourc);
|
|
|
+ log.warn("getStream success 2 " + filePath);
|
|
|
return stream;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
try {
|
|
|
- InputStream stream = new ClassPathResource(File.separator + resourc).getInputStream();
|
|
|
- if (stream != null) {
|
|
|
- log.info("使用3路径{}获取配置{}", "ClassPathResource/" + resourc, resourc);
|
|
|
- return stream;
|
|
|
+ // ClassPath目录
|
|
|
+ InputStream in = new org.springframework.core.io.ClassPathResource(File.separator + resourc).getInputStream();
|
|
|
+ if (in != null) {
|
|
|
+ log.warn("getStream success 3 " + "ClassPathResource" + resourc);
|
|
|
+ return in;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
try {
|
|
|
InputStream stream = Constant.class.getResourceAsStream(File.separator + resourc);
|
|
|
if (stream != null) {
|
|
|
- log.info("使用4路径{}获取配置{}", "resource/" + resourc, resourc);
|
|
|
+ log.warn("getStream success 4 " + "getResourceAsStream" + resourc);
|
|
|
return stream;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
-
|
|
|
- log.info("无法获取配置{}", resourc);
|
|
|
+ log.warn("getStream fail " + resourc);
|
|
|
return null;
|
|
|
}
|
|
|
|