code: public Configuration createConfiguration() throws IOException, TemplateException {
          Configuration config = newConfiguration();
          Properties props = new Properties();
  
          // Merge local properties if specified.
          if (this.freemarkerSettings != null) {
              props.putAll(this.freemarkerSettings);
          }
  
          // FreeMarker will only accept known keys in its setSettings and
          // setAllSharedVariables methods.
          if (!props.isEmpty()) {
              config.setSettings(props);
          }
  
          if (this.freemarkerVariables != null && freemarkerVariables.size() > 0) {
              config.setAllSharedVariables(new SimpleHash(this.freemarkerVariables, config.getObjectWrapper()));
          }
  
          if (this.defaultEncoding != null) {
              config.setDefaultEncoding(this.defaultEncoding);
          }
  
          // determine FreeMarker TemplateLoader
          if (templateLoaders == null) {
              if (templateLoaderPaths != null && templateLoaderPaths.length > 0) {
                  List<TemplateLoader> templateLoaderList = new ArrayList<>();
                  for (String path : templateLoaderPaths) {
                      templateLoaderList.add(getTemplateLoaderForPath(path));
                  }
                  setTemplateLoader(templateLoaderList);
              }
          }
  
          TemplateLoader templateLoader = getAggregateTemplateLoader(templateLoaders);
          if (templateLoader != null) {
              config.setTemplateLoader(templateLoader);
          }
  
          // determine CustomTrimDirectives
          if (trimDirectives != null && trimDirectives.length > 0) {
              TrimDirectiveGroup group = new TrimDirectiveGroup(trimDirectives);
              for (Map.Entry<String, Map<String, TrimDirective>> directives : group.entrySet()) {
                  config.setSharedVariable(directives.getKey(), directives.getValue());
              }
          }
  
          return config;
      }
docs: Prepare the FreeMarker Configuration and return it.
  
  @return the FreeMarker Configuration object
  @throws IOException if the config file wasn't found
  @throws TemplateException on FreeMarker initialization failure