コード例 #1
0
  public String selConfig(String config) {

    try {

      String str = properties.getProperty(config);
      if (str == null) return null;
      String reStr = new String(str.getBytes("ISO-8859-1"), "UTF-8");
      return reStr;
    } catch (Exception e) {
      Loggerfactory.error(logger, e);
      return null;
    }
  }
コード例 #2
0
  public void loadConfig() {

    try {

      InputStream in =
          Thread.currentThread()
              .getContextClassLoader()
              .getResourceAsStream(SystemConfig.system_config_file);
      if (in == null)
        in = getClass().getClassLoader().getResourceAsStream(SystemConfig.system_config_file);
      if (in == null) in = this.getClass().getResourceAsStream(SystemConfig.system_config_file);
      if (in == null)
        throw new RuntimeException(
            " not find  load  Config  file : " + SystemConfig.system_config_file);
      properties.load(in);
    } catch (Exception e) {
      Loggerfactory.error(logger, e);
    }
  }