935090232@qq.com
2022-02-20 27fb5ec5798a4dd30ba437a9a922a2d78544e301
zq-erp/src/main/java/com/matrix/component/ueditor/ConfigManager.java
@@ -16,17 +16,19 @@
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import com.matrix.core.tools.PropertiesUtil;
/**
 * 配置管理器
 *
 *
 * @author hancong03@baidu.com
 *
 */
public final class ConfigManager {
public final class ConfigManager implements EnvironmentAware {
   private Environment env;
   private final String rootPath;
   private final String originalPath;
   private final String contextPath;
@@ -37,8 +39,15 @@
   private final static String SCRAWL_FILE_NAME = "scrawl";
   // 远程图片抓取filename定义
   private final static String REMOTE_FILE_NAME = "remote";
   private final static String FILES_TORAGE_PATH ="file_storage_path";
   @Override
   public void setEnvironment(Environment environment) {
      env = environment;
   }
   /*
    * 通过一个给定的路径构建一个配置管理器, 该管理器要求地址路径所在目录下必须存在config.properties文件
@@ -60,7 +69,7 @@
   /**
    * 配置管理器构造工厂
    *
    *
    * @param rootPath
    *            服务器根路径
    * @param contextPath
@@ -152,7 +161,9 @@
      }
      conf.put("savePath", savePath);
      conf.put("rootPath", PropertiesUtil.getString(this.FILES_TORAGE_PATH));
      String fileStoragePath = env.getProperty(FILES_TORAGE_PATH);
      conf.put("rootPath",fileStoragePath);
      return conf;