Skip to content

Instantly share code, notes, and snippets.

@AnjaliManhas
Last active May 10, 2020 11:31
Show Gist options
  • Save AnjaliManhas/01695ae2af56b69cee0becc1f5c63775 to your computer and use it in GitHub Desktop.
Save AnjaliManhas/01695ae2af56b69cee0becc1f5c63775 to your computer and use it in GitHub Desktop.
import freemarker.template.Configuration;
import freemarker.template.TemplateExceptionHandler;
import java.io.File;
import java.io.IOException;
public class TemplateConfigurationContext {
private static Configuration configuration = new Configuration(Configuration.VERSION_2_3_27);
public static Configuration getConfiguration() {
try {
configuration.setDirectoryForTemplateLoading(new File("C:\\Users\\HP\\IdeaProjects\\myRestProject\\src\\HelloWorld"));
configuration.setDefaultEncoding("UTF-8");
configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
configuration.setLogTemplateExceptions(false);
configuration.setWrapUncheckedExceptions(true);
} catch (IOException e) {
e.printStackTrace();
}
return configuration;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment