diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java index 4528546a67..3558d565da 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationConfig; @@ -172,7 +171,7 @@ public class ConfigurationPropertiesReportEndpoint */ protected void configureObjectMapper(ObjectMapper mapper) { mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - mapper.setSerializationInclusion(Include.NON_NULL); + mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); applyCglibFilters(mapper); applySerializationModifier(mapper); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java index db9e820621..3c124362a4 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpointTests.java @@ -61,18 +61,6 @@ public class ConfigurationPropertiesReportEndpointTests assertThat(nestedProperties).isNotNull(); assertThat(nestedProperties.get("prefix")).isEqualTo("test"); assertThat(nestedProperties.get("properties")).isNotNull(); - - } - - @Test - @SuppressWarnings("unchecked") - public void entriesWithNullValuesAreNotIncluded() { - ConfigurationPropertiesReportEndpoint report = getEndpointBean(); - Map properties = report.invoke(); - Map nestedProperties = (Map) properties - .get("testProperties"); - assertThat((Map) nestedProperties.get("properties")) - .doesNotContainKey("nullValue"); } @Test @@ -286,8 +274,6 @@ public class ConfigurationPropertiesReportEndpointTests private List> listOfListItems = new ArrayList<>(); - private String nullValue = null; - public TestProperties() { this.secrets.put("mine", "myPrivateThing"); this.secrets.put("yours", "yourPrivateThing"); @@ -351,14 +337,6 @@ public class ConfigurationPropertiesReportEndpointTests this.listOfListItems = listOfListItems; } - public String getNullValue() { - return this.nullValue; - } - - public void setNullValue(String nullValue) { - this.nullValue = nullValue; - } - public static class Hidden { private String mine = "mySecret"; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java index 2d695efdf5..94bc795ef1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfigurationTests.java @@ -30,8 +30,6 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.databind.AnnotationIntrospector; -import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.MapperFeature; @@ -40,6 +38,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.util.StdDateFormat; import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; @@ -60,7 +59,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Primary; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; -import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -447,12 +445,10 @@ public class JacksonAutoConfigurationTests { Class... configClasses) { this.context.register(configClasses); this.context.refresh(); - DeserializationConfig deserializationConfig = this.context - .getBean(ObjectMapper.class).getDeserializationConfig(); - AnnotationIntrospector annotationIntrospector = deserializationConfig - .getAnnotationIntrospector().allIntrospectors().iterator().next(); - assertThat(ReflectionTestUtils.getField(annotationIntrospector, "creatorBinding")) - .isEqualTo(expectedMode); + Annotated annotated = mock(Annotated.class); + Mode mode = this.context.getBean(ObjectMapper.class).getDeserializationConfig() + .getAnnotationIntrospector().findCreatorBinding(annotated); + assertThat(mode).isEqualTo(expectedMode); } public static class MyDateFormat extends SimpleDateFormat { diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 7812a213fa..244ed91c68 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -94,7 +94,7 @@ 4.5.3 4.4.6 8.2.6.Final - 2.9.0.pr1 + 2.8.7 2.7.8 3.21.0-GA 1.0.0