Skip to content

Commit 6d4083a

Browse files
committed
Merge branch '1.3.x'
2 parents 13c0137 + a4d7a77 commit 6d4083a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ public ThymeleafViewResolver thymeleafViewResolver() {
248248
// This resolver acts as a fallback resolver (e.g. like a
249249
// InternalResourceViewResolver) so it needs to have low precedence
250250
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
251+
resolver.setCache(this.properties.isCache());
251252
return resolver;
252253
}
253254

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfigurationTests.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,18 @@ public void layoutDialectCanBeCustomized() throws Exception {
245245
.isInstanceOf(GroupingStrategy.class);
246246
}
247247

248+
@Test
249+
public void cachingCanBeDisabled() {
250+
this.context.register(ThymeleafAutoConfiguration.class,
251+
PropertyPlaceholderAutoConfiguration.class);
252+
EnvironmentTestUtils.addEnvironment(this.context, "spring.thymeleaf.cache:false");
253+
this.context.refresh();
254+
assertThat(this.context.getBean(ThymeleafViewResolver.class).isCache()).isFalse();
255+
TemplateResolver templateResolver = this.context.getBean(TemplateResolver.class);
256+
templateResolver.initialize();
257+
assertThat(templateResolver.isCacheable()).isFalse();
258+
}
259+
248260
@Configuration
249261
@ImportAutoConfiguration({ ThymeleafAutoConfiguration.class,
250262
PropertyPlaceholderAutoConfiguration.class })

0 commit comments

Comments
 (0)