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
This commit is contained in:
parent
a601901a6c
commit
5eb1e26e10
|
|
@ -152,6 +152,7 @@ org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration,\
|
|||
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration
|
||||
|
||||
# DefaultTestExecutionListenersPostProcessors
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAuto
|
|||
import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
|
@ -76,4 +77,9 @@ class WebMvcTestAutoConfigurationIntegrationTests {
|
|||
"taskExecutor")).isSameAs(this.applicationContext.getBean("applicationTaskExecutor"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void httpEncodingAutoConfigurationWasImported() {
|
||||
assertThat(this.applicationContext).has(importedAutoConfiguration(HttpEncodingAutoConfiguration.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue