public final synchronized freemarker.template.Configuration getConfiguration(ServletContext servletContext) throws TemplateException { freemarker.template.Configuration config = (freemarker.template.Configuration) servletContext.getAttribute(CONFIG_SERVLET_CONTEXT_KEY); if (config == null) { config = createConfiguration(servletContext); // store this configuration in the servlet context servletContext.setAttribute(CONFIG_SERVLET_CONTEXT_KEY, config); } config.setWhitespaceStripping(true); return config; }