Commit 5eb1e26e authored by Brian Clozel's avatar Brian Clozel

Add HttpEncodingAutoConfiguration to WebMvcTest

Prior to this commit, tests using the `@WebMvcTest` annotation would not
include the `HttpEncodingAutoConfiguration`. This means that, even if
configured, the encoding filter would not be configured in MVC tests,
resulting in an inconsistency with `@SpringBootTest` tests.

This commit ensures that the `HttpEncodingAutoConfiguration` is included
when `@WebMvcTest` is used.

Fixes gh-23749
parent a601901a
...@@ -152,6 +152,7 @@ org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration,\ ...@@ -152,6 +152,7 @@ org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration,\
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\ org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\ org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration,\ org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration,\
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration,\
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration
# DefaultTestExecutionListenersPostProcessors # DefaultTestExecutionListenersPostProcessors
......
...@@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAuto ...@@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAuto
import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration;
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration; import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.core.task.AsyncTaskExecutor; import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.util.ReflectionTestUtils;
...@@ -76,4 +77,9 @@ class WebMvcTestAutoConfigurationIntegrationTests { ...@@ -76,4 +77,9 @@ class WebMvcTestAutoConfigurationIntegrationTests {
"taskExecutor")).isSameAs(this.applicationContext.getBean("applicationTaskExecutor")); "taskExecutor")).isSameAs(this.applicationContext.getBean("applicationTaskExecutor"));
} }
@Test
void httpEncodingAutoConfigurationWasImported() {
assertThat(this.applicationContext).has(importedAutoConfiguration(HttpEncodingAutoConfiguration.class));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment