From 5d32ec74637f299eb547a49419a9016f6c58bd78 Mon Sep 17 00:00:00 2001 From: Michael Stummvoll Date: Thu, 2 Oct 2014 14:25:56 +0200 Subject: [PATCH] Add VelocityProperties.preferFilesystemAccess Update VelocityProperties to include a preferFilesystemAccess attribute. Fixes gh-1652 --- .../velocity/VelocityAutoConfiguration.java | 1 + .../autoconfigure/velocity/VelocityProperties.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java index 1343a5b5a5f..0b99ad32ef6 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java @@ -81,6 +81,7 @@ public class VelocityAutoConfiguration { protected void applyProperties(VelocityEngineFactory factory) { factory.setResourceLoaderPath(this.properties.getResourceLoaderPath()); + factory.setPreferFileSystemAccess(this.properties.isPreferFileSystemAccess()); Properties velocityProperties = new Properties(); velocityProperties.putAll(this.properties.getProperties()); factory.setVelocityProperties(velocityProperties); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java index 020034f3b38..2ca79ee7dd2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java @@ -48,6 +48,8 @@ public class VelocityProperties extends AbstractTemplateViewResolverProperties { private String toolboxConfigLocation; + private boolean preferFileSystemAccess = true; + public VelocityProperties() { super(DEFAULT_PREFIX, DEFAULT_SUFFIX); } @@ -92,6 +94,14 @@ public class VelocityProperties extends AbstractTemplateViewResolverProperties { this.toolboxConfigLocation = toolboxConfigLocation; } + public boolean isPreferFileSystemAccess() { + return this.preferFileSystemAccess; + } + + public void setPreferFileSystemAccess(boolean preferFileSystemAccess) { + this.preferFileSystemAccess = preferFileSystemAccess; + } + @Override public void applyToViewResolver(Object viewResolver) { super.applyToViewResolver(viewResolver);