Example usage for org.springframework.web.servlet.view.freemarker FreeMarkerConfigurer setTemplateLoaderPaths

List of usage examples for org.springframework.web.servlet.view.freemarker FreeMarkerConfigurer setTemplateLoaderPaths

Introduction

In this page you can find the example usage for org.springframework.web.servlet.view.freemarker FreeMarkerConfigurer setTemplateLoaderPaths.

Prototype

public void setTemplateLoaderPaths(String... templateLoaderPaths) 

Source Link

Document

Set multiple Freemarker template loader paths via Spring resource locations.

Usage

From source file:org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardConfiguration.java

/**
 * Overrides Spring Boot's {@link FreeMarkerAutoConfiguration} to prefer using a
 * {@link SpringTemplateLoader} instead of the file system. This corrects an issue
 * where Spring Boot may use an empty 'templates' file resource to resolve templates
 * instead of the packaged Hystrix classpath templates.
 * @return FreeMarker configuration//from   w  ww .  j a v a  2 s.  c  om
 */
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
    FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
    configurer.setTemplateLoaderPaths(DEFAULT_TEMPLATE_LOADER_PATH);
    configurer.setDefaultEncoding(DEFAULT_CHARSET);
    configurer.setPreferFileSystemAccess(false);
    return configurer;
}