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

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

Introduction

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

Prototype

public void setPreferFileSystemAccess(boolean preferFileSystemAccess) 

Source Link

Document

Set whether to prefer file system access for template loading.

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// w w  w.  j  a v  a2s .c o m
 */
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
    FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
    configurer.setTemplateLoaderPaths(DEFAULT_TEMPLATE_LOADER_PATH);
    configurer.setDefaultEncoding(DEFAULT_CHARSET);
    configurer.setPreferFileSystemAccess(false);
    return configurer;
}