This commit is contained in:
hxy1991 2019-04-01 11:48:53 +08:00
parent b1790fa09e
commit 9c9050207e

View File

@ -16,6 +16,7 @@
package com.alibaba.nacos.core.utils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,8 +35,8 @@ public class PropertyUtil {
private static final Logger log = LoggerFactory.getLogger(PropertyUtil.class);
static {
InputStream inputStream = null;
try {
InputStream inputStream = null;
String baseDir = System.getProperty("nacos.home");
if (!StringUtils.isBlank(baseDir)) {
inputStream = new FileInputStream(baseDir + "/conf/application.properties");
@ -46,6 +47,8 @@ public class PropertyUtil {
properties.load(inputStream);
} catch (Exception e) {
log.error("read property file error:" + e);
} finally {
IOUtils.closeQuietly(inputStream);
}
}