From 584464807eb697a1f78840dbf08fddb69f8a3f41 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Tue, 26 Jan 2021 22:51:34 +0100 Subject: [PATCH] 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. --- pom.xml | 2 +- .../web/config/SpringDataWebConfigurationIntegrationTests.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 99f4123b1..9be85dfb7 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ javax.servlet javax.servlet-api - 3.0.1 + 4.0.1 provided diff --git a/src/test/java/org/springframework/data/web/config/SpringDataWebConfigurationIntegrationTests.java b/src/test/java/org/springframework/data/web/config/SpringDataWebConfigurationIntegrationTests.java index 6bdaa22b9..8f3b9ca0c 100644 --- a/src/test/java/org/springframework/data/web/config/SpringDataWebConfigurationIntegrationTests.java +++ b/src/test/java/org/springframework/data/web/config/SpringDataWebConfigurationIntegrationTests.java @@ -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); }); });