use of org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver in project spring-boot by spring-projects.
the class LocalDevToolsAutoConfigurationTests method defaultPropertyCanBeOverriddenFromUserHomeProperties.
@Test
public void defaultPropertyCanBeOverriddenFromUserHomeProperties() throws Exception {
String userHome = System.getProperty("user.home");
System.setProperty("user.home", new File("src/test/resources/user-home").getAbsolutePath());
try {
this.context = initializeAndRun(Config.class);
SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class);
assertThat(resolver.isCacheable()).isTrue();
} finally {
System.setProperty("user.home", userHome);
}
}
use of org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver in project spring-boot by spring-projects.
the class ThymeleafAutoConfigurationTests method cachingCanBeDisabled.
@Test
public void cachingCanBeDisabled() {
this.context.register(ThymeleafAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "spring.thymeleaf.cache:false");
this.context.refresh();
assertThat(this.context.getBean(ThymeleafViewResolver.class).isCache()).isFalse();
SpringResourceTemplateResolver templateResolver = this.context.getBean(SpringResourceTemplateResolver.class);
assertThat(templateResolver.isCacheable()).isFalse();
}
use of org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver in project spring-security by spring-projects.
the class WebMvcConfiguration method templateResolver.
private SpringResourceTemplateResolver templateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
resolver.setPrefix("classpath:/views/");
resolver.setSuffix(".html");
resolver.setTemplateMode(TemplateMode.HTML);
resolver.setApplicationContext(applicationContext);
return resolver;
}
use of org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver in project spring-boot by spring-projects.
the class ThymeleafAutoConfigurationTests method overrideCharacterEncoding.
@Test
public void overrideCharacterEncoding() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "spring.thymeleaf.encoding:UTF-16");
this.context.register(ThymeleafAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
ITemplateResolver resolver = this.context.getBean(ITemplateResolver.class);
assertThat(resolver instanceof SpringResourceTemplateResolver).isTrue();
assertThat(((SpringResourceTemplateResolver) resolver).getCharacterEncoding()).isEqualTo("UTF-16");
ThymeleafViewResolver views = this.context.getBean(ThymeleafViewResolver.class);
assertThat(views.getCharacterEncoding()).isEqualTo("UTF-16");
assertThat(views.getContentType()).isEqualTo("text/html;charset=UTF-16");
}
use of org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver in project spring-boot by spring-projects.
the class LocalDevToolsAutoConfigurationTests method thymeleafCacheIsFalse.
@Test
public void thymeleafCacheIsFalse() throws Exception {
this.context = initializeAndRun(Config.class);
SpringResourceTemplateResolver resolver = this.context.getBean(SpringResourceTemplateResolver.class);
assertThat(resolver.isCacheable()).isFalse();
}
Aggregations