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 515a84f36c1..ac8f4c77e09 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 @@ -66,7 +66,7 @@ public class FreeMarkerAutoConfiguration { public void checkTemplateLocationExists() { if (this.properties.isCheckTemplateLocation()) { Resource resource = this.resourceLoader - .getResource(this.properties.getPath()); + .getResource(this.properties.getTemplateLoaderPath()); Assert.state(resource.exists(), "Cannot find template location: " + resource + " (please add some templates " + "or check your FreeMarker configuration)"); @@ -79,7 +79,7 @@ public class FreeMarkerAutoConfiguration { protected FreeMarkerProperties properties; protected void applyProperties(FreeMarkerConfigurationFactory factory) { - factory.setTemplateLoaderPath(this.properties.getPath()); + factory.setTemplateLoaderPath(this.properties.getTemplateLoaderPath()); factory.setDefaultEncoding(this.properties.getCharSet()); Properties settings = new Properties(); settings.putAll(this.properties.getSettings()); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java index cc4b185974e..6dfe4dad5bf 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java @@ -39,7 +39,7 @@ public class FreeMarkerProperties { private String suffix = DEFAULT_SUFFIX; - private String path = DEFAULT_TEMPLATE_LOADER_PATH; + private String templateLoaderPath = DEFAULT_TEMPLATE_LOADER_PATH; private boolean cache; @@ -121,12 +121,12 @@ public class FreeMarkerProperties { this.suffix = suffix; } - public String getPath() { - return this.path; + public String getTemplateLoaderPath() { + return this.templateLoaderPath; } - public void setPath(String path) { - this.path = path; + public void setTemplateLoaderPath(String templateLoaderPath) { + this.templateLoaderPath = templateLoaderPath; } public String getRequestContextAttribute() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java index b889e026deb..1b972db8615 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java @@ -72,14 +72,14 @@ public class FreeMarkerAutoConfigurationTests { @Test(expected = BeanCreationException.class) public void nonExistentTemplateLocation() { - registerAndRefreshContext("spring.freemarker.path:" + registerAndRefreshContext("spring.freemarker.templateLoaderPath:" + "classpath:/does-not-exist/"); } @Test public void emptyTemplateLocation() { new File("target/test-classes/templates/empty-directory").mkdir(); - registerAndRefreshContext("spring.freemarker.path:" + registerAndRefreshContext("spring.freemarker.templateLoaderPath:" + "classpath:/templates/empty-directory/"); } @@ -119,7 +119,7 @@ public class FreeMarkerAutoConfigurationTests { @Test public void customTemplateLoaderPath() throws Exception { - registerAndRefreshContext("spring.freemarker.path:classpath:/custom-templates/"); + registerAndRefreshContext("spring.freemarker.templateLoaderPath:classpath:/custom-templates/"); MockHttpServletResponse response = render("custom"); String result = response.getContentAsString(); assertThat(result, containsString("custom"));