Merge pull request #2901 from creactiviti/freemarker-autoconfigure-preferfilesystemaccess
* pr/2901: Add Freemarker `prefer-file-system-access` support
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,6 +91,7 @@ public class FreeMarkerAutoConfiguration {
|
||||
|
||||
protected void applyProperties(FreeMarkerConfigurationFactory factory) {
|
||||
factory.setTemplateLoaderPaths(this.properties.getTemplateLoaderPath());
|
||||
factory.setPreferFileSystemAccess(this.properties.isPreferFileSystemAccess());
|
||||
factory.setDefaultEncoding(this.properties.getCharset());
|
||||
Properties settings = new Properties();
|
||||
settings.putAll(this.properties.getSettings());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,6 +48,12 @@ public class FreeMarkerProperties extends AbstractTemplateViewResolverProperties
|
||||
*/
|
||||
private String[] templateLoaderPath = new String[] { DEFAULT_TEMPLATE_LOADER_PATH };
|
||||
|
||||
/**
|
||||
* Prefer file system access for template loading. File system access enables hot
|
||||
* detection of template changes.
|
||||
*/
|
||||
private boolean preferFileSystemAccess = true;
|
||||
|
||||
public FreeMarkerProperties() {
|
||||
super(DEFAULT_PREFIX, DEFAULT_SUFFIX);
|
||||
}
|
||||
@@ -64,6 +70,14 @@ public class FreeMarkerProperties extends AbstractTemplateViewResolverProperties
|
||||
return this.templateLoaderPath;
|
||||
}
|
||||
|
||||
public boolean isPreferFileSystemAccess() {
|
||||
return this.preferFileSystemAccess;
|
||||
}
|
||||
|
||||
public void setPreferFileSystemAccess(boolean preferFileSystemAccess) {
|
||||
this.preferFileSystemAccess = preferFileSystemAccess;
|
||||
}
|
||||
|
||||
public void setTemplateLoaderPath(String... templateLoaderPaths) {
|
||||
this.templateLoaderPath = templateLoaderPaths;
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.freemarker.expose-session-attributes=false
|
||||
spring.freemarker.expose-spring-macro-helpers=false
|
||||
spring.freemarker.prefix=
|
||||
spring.freemarker.prefer-file-system-access=true # prefer file system access for template loading
|
||||
spring.freemarker.request-context-attribute=
|
||||
spring.freemarker.settings.*=
|
||||
spring.freemarker.suffix=.ftl
|
||||
|
||||
Reference in New Issue
Block a user