From 6c3d64a2eb1e45c693ec859cc1132804a988e9a9 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 28 Mar 2019 17:59:22 +0100 Subject: [PATCH] Test Thymeleaf auto-configuration backs off without spring integration See gh-16341 --- .../ThymeleafServletAutoConfigurationTests.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java index f4c649b95b..ae056e4d9f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java @@ -38,6 +38,7 @@ import org.thymeleaf.spring5.view.ThymeleafViewResolver; import org.thymeleaf.templateresolver.ITemplateResolver; import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.test.rule.OutputCapture; @@ -78,6 +79,14 @@ public class ThymeleafServletAutoConfigurationTests { private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() .withConfiguration(AutoConfigurations.of(ThymeleafAutoConfiguration.class)); + @Test + public void autoConfigurationBackOffWithoutThymeleafSpring() { + this.contextRunner + .withClassLoader(new FilteredClassLoader("org.thymeleaf.spring5")) + .run((context) -> assertThat(context) + .doesNotHaveBean(TemplateEngine.class)); + } + @Test public void createFromConfigClass() { this.contextRunner.withPropertyValues("spring.thymeleaf.mode:HTML",