Upgrade to Servlet 4.0 to align with Spring Framework.

Also, tweak test case to avoid to refer to a field in a Spring class but rather use API to access the value. Changes in Spring Framework 5.3.4 require this as the internal structure of AbstractJackson2HttpMessageConverter changed to support custom ObjectMapper instances per type and media type.

Fixes GH-2284.
This commit is contained in:
Oliver Drotbohm
2021-01-26 22:51:34 +01:00
parent a097edb07d
commit f83a2edb69
2 changed files with 2 additions and 3 deletions

View File

@@ -72,7 +72,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>

View File

@@ -32,7 +32,6 @@ import org.springframework.data.web.ProjectingJackson2HttpMessageConverter;
import org.springframework.data.web.XmlBeamHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.instrument.classloading.ShadowingClassLoader;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.ReflectionUtils;
import org.xmlbeam.XBProjector;
@@ -103,7 +102,7 @@ class SpringDataWebConfigurationIntegrationTests {
// Converters contains ProjectingJackson2HttpMessageConverter with custom ObjectMapper
assertThat(converters).anySatisfy(converter -> {
assertThat(converter).isInstanceOfSatisfying(ProjectingJackson2HttpMessageConverter.class, __ -> {
assertThat(ReflectionTestUtils.getField(converter, "objectMapper")).isSameAs(SomeConfiguration.MAPPER);
assertThat(__.getObjectMapper()).isSameAs(SomeConfiguration.MAPPER);
});
});