Change exception message for missing Thymeleaf templates

Fixes gh-424
This commit is contained in:
Dave Syer 2014-03-05 09:07:15 +00:00
parent 6b83e0ad5d
commit ffe91ca6bf
2 changed files with 7 additions and 4 deletions

View File

@ -84,8 +84,11 @@ public class ThymeleafAutoConfiguration {
if (checkTemplateLocation) {
Resource resource = this.resourceLoader.getResource(this.environment
.getProperty("prefix", DEFAULT_PREFIX));
Assert.state(resource.exists(), "Cannot find template location: "
+ resource + " (are you really using Thymeleaf?)");
Assert.state(
resource.exists(),
"Cannot find template location: "
+ resource
+ " (please add some templates or check your Thymeleaf configuration)");
}
}

View File

@ -16,11 +16,11 @@
package org.springframework.boot.autoconfigure.thymeleaf;
import java.io.File;
import java.util.Collections;
import java.util.Locale;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
@ -95,8 +95,8 @@ public class ThymeleafAutoConfigurationTests {
}
@Test
@Ignore("Fix this for gh-424")
public void templateLocationEmpty() throws Exception {
new File("target/test-classes/templates/empty-directory").mkdir();
EnvironmentTestUtils.addEnvironment(this.context,
"spring.thymeleaf.prefix:classpath:/templates/empty-directory/");
this.context.register(ThymeleafAutoConfiguration.class,