From 6aa0055e5edeaa3ed233d90a81d8ce22d5714714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Mon, 17 Feb 2025 11:01:23 +0100 Subject: [PATCH] Polish "Do not auto-configure ViewResolver if spring-webmvc is absent" See gh-44259 --- .../thymeleaf/ThymeleafServletAutoConfigurationTests.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 205069e8ec..9f58eefb4a 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 @@ -46,7 +46,6 @@ import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.boot.testsupport.BuildOutput; -import org.springframework.boot.testsupport.classpath.ClassPathExclusions; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter; import org.springframework.context.annotation.Bean; @@ -61,6 +60,7 @@ import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter; import org.springframework.web.servlet.support.RequestContext; +import org.springframework.web.servlet.view.AbstractCachingViewResolver; import static org.assertj.core.api.Assertions.assertThat; @@ -338,9 +338,8 @@ class ThymeleafServletAutoConfigurationTests { } @Test - @ClassPathExclusions("spring-webmvc-*.jar") void missingAbstractCachingViewResolver() { - this.contextRunner + this.contextRunner.withClassLoader(new FilteredClassLoader(AbstractCachingViewResolver.class)) .run((context) -> assertThat(context).hasNotFailed().doesNotHaveBean("thymeleafViewResolver")); }