path->templateLoaderPath
This commit is contained in:
parent
898250431a
commit
0a11459c3e
|
@ -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());
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue