class TemplatingConfigurationImpl implements TemplatingConfiguration {

    public Configuration getFreemarkerConfiguration(final boolean localizedLookupEnabled) {
        final freemarker.template.Configuration cfg = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_28);
        cfg.setTemplateLoader(new URLTemplateLoader() {
            @Override
            protected URL getURL(final String resourceName) {
                try {
                    final Resource resource = getResource(resourceName);
                    return resource.exists() ? resource.getURL() : null;
                } catch (final IOException ex) {
                    throw new TemplateLookupFailedException(resourceName, templatesPath, ex);
                }
            }
        });
        cfg.setLocalizedLookup(localizedLookupEnabled);
        cfg.setDefaultEncoding("UTF-8");
        cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
        cfg.setLogTemplateExceptions(false);
        cfg.setWrapUncheckedExceptions(true);
        return cfg;
    }

      TemplatingConfigurationImpl(
            @Value("${notifier.templates.path}") final String templatesPath,
            @Value("${notifier.templates.extension:.ftl}") final String templateExtension);

}