From 85ac8f6b052cd34f1ef792228de7426d7ec64a80 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 19 May 2014 16:53:58 +0100 Subject: [PATCH] Add config hint to template error messages --- .../freemarker/FreeMarkerAutoConfiguration.java | 9 ++++++--- .../velocity/VelocityAutoConfiguration.java | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java index 1ed1c445931..64380ffeda5 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java @@ -67,9 +67,12 @@ public class FreeMarkerAutoConfiguration { if (this.properties.isCheckTemplateLocation()) { Resource resource = this.resourceLoader.getResource(this.properties .getTemplateLoaderPath()); - Assert.state(resource.exists(), "Cannot find template location: " + resource - + " (please add some templates " - + "or check your FreeMarker configuration)"); + Assert.state( + resource.exists(), + "Cannot find template location: " + + resource + + " (please add some templates, check your FreeMarker configuration, or set " + + "spring.freemarker.checkTemplateLocation=false)"); } } 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 689152cbfce..bb4525a1388 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 @@ -69,9 +69,11 @@ public class VelocityAutoConfiguration { if (this.properties.isCheckTemplateLocation()) { Resource resource = this.resourceLoader.getResource(this.properties .getResourceLoaderPath()); - Assert.state(resource.exists(), "Cannot find template location: " + resource - + " (please add some templates " - + "or check your Velocity configuration)"); + Assert.state( + resource.exists(), + "Cannot find template location: " + + resource + + " (please add some templates, check your Velocity configuration, or set spring.velocity.checkTemplateLocation=false)"); } }