code: private String interpolate(List<String> lines, Map<String, Object> replaces, char mode) {
          for (int i = 0; i < lines.size(); i++) {
              String line = lines.get(i);
              if (!line.trim().startsWith("#") && line.contains("=")) {
                  String[] array = line.split("=");
                  String key = array[0].trim();
                  // string like: neo4j.user= split array length == 1
                  String value;
                  if (array.length == 2) {
                      value = array[1];
                  } else if (array.length == 1) {
                      value = "";
                  } else {
                      continue;//don't touch them
                  }
                  value = interpolate(value, replaces, mode);
                  if (replaces.containsKey(key)) {
                      value = replaces.get(key).toString();
                  }
                  lines.set(i, key + "=" + value);
              }
          }
          return StringUtils.join(lines, lineSeparator);
      }
docs: interpolate properties file like: http.port=the.default.value