static String applyTemplate(final String template,final Map<String,Object> map){
  configuration=getConfiguration();
  try (ByteArrayOutputStream outputStream=new ByteArrayOutputStream();Writer writer=new OutputStreamWriter(outputStream)){
    Template configurationTemplate=configuration.getTemplate(template);
    configurationTemplate.process(map,writer);
    return outputStream.toString();
  }
 catch (  Exception e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}

static String applyTemplate ( final String template , final Map < String , Object > map ) { configuration = getConfiguration ( ) ; try ( ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; Writer writer = new OutputStreamWriter ( outputStream ) ) { Template configurationTemplate = configuration . getTemplate ( template ) ; configurationTemplate . process ( map , writer ) ; return outputStream . toString ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } }
returns the string result from applying a freemarker template .
