org.springframework.ui.freemarker.FreeMarkerConfigurationFactory Java Examples

The following examples show how to use org.springframework.ui.freemarker.FreeMarkerConfigurationFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlobalConfig.java    From pacbot with Apache License 2.0 5 votes vote down vote up
@Bean
public FreeMarkerConfigurer freemarkerConfig() throws IOException, TemplateException {
    FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
    factory.setTemplateLoaderPaths("classpath:templates", "src/main/resources/templates");
    factory.setDefaultEncoding("UTF-8");
    FreeMarkerConfigurer result = new FreeMarkerConfigurer();
    result.setConfiguration(factory.createConfiguration());
    return result;
}
 
Example #2
Source File: WebFtlsContextConfig.java    From onetwo with Apache License 2.0 5 votes vote down vote up
protected void applyProperties(FreeMarkerConfigurationFactory factory) {
	factory.setTemplateLoaderPaths(this.properties.getTemplateLoaderPath());
	factory.setPreferFileSystemAccess(this.properties.isPreferFileSystemAccess());
	factory.setDefaultEncoding(this.properties.getCharsetName());
	Properties settings = new Properties();
	settings.putAll(this.properties.getSettings());
	factory.setFreemarkerSettings(settings);
}