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 1343a5b5a5..0b99ad32ef 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 020034f3b3..2ca79ee7dd 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);