Revert "Upgrade to Jackson 2.9.0.pr1"

This reverts commit 10ae5e8f3f. Health
serialization fails with Jackson 2.9.0 (gh-7695).

See gh-8537
pull/8496/merge
Andy Wilkinson 8 years ago
parent 10ae5e8f3f
commit 1893fdab0d

@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationConfig; import com.fasterxml.jackson.databind.SerializationConfig;
@ -172,7 +171,7 @@ public class ConfigurationPropertiesReportEndpoint
*/ */
protected void configureObjectMapper(ObjectMapper mapper) { protected void configureObjectMapper(ObjectMapper mapper) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.setSerializationInclusion(Include.NON_NULL); mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
applyCglibFilters(mapper); applyCglibFilters(mapper);
applySerializationModifier(mapper); applySerializationModifier(mapper);
} }

@ -61,18 +61,6 @@ public class ConfigurationPropertiesReportEndpointTests
assertThat(nestedProperties).isNotNull(); assertThat(nestedProperties).isNotNull();
assertThat(nestedProperties.get("prefix")).isEqualTo("test"); assertThat(nestedProperties.get("prefix")).isEqualTo("test");
assertThat(nestedProperties.get("properties")).isNotNull(); assertThat(nestedProperties.get("properties")).isNotNull();
}
@Test
@SuppressWarnings("unchecked")
public void entriesWithNullValuesAreNotIncluded() {
ConfigurationPropertiesReportEndpoint report = getEndpointBean();
Map<String, Object> properties = report.invoke();
Map<String, Object> nestedProperties = (Map<String, Object>) properties
.get("testProperties");
assertThat((Map<String, Object>) nestedProperties.get("properties"))
.doesNotContainKey("nullValue");
} }
@Test @Test
@ -286,8 +274,6 @@ public class ConfigurationPropertiesReportEndpointTests
private List<List<ListItem>> listOfListItems = new ArrayList<>(); private List<List<ListItem>> listOfListItems = new ArrayList<>();
private String nullValue = null;
public TestProperties() { public TestProperties() {
this.secrets.put("mine", "myPrivateThing"); this.secrets.put("mine", "myPrivateThing");
this.secrets.put("yours", "yourPrivateThing"); this.secrets.put("yours", "yourPrivateThing");
@ -351,14 +337,6 @@ public class ConfigurationPropertiesReportEndpointTests
this.listOfListItems = listOfListItems; this.listOfListItems = listOfListItems;
} }
public String getNullValue() {
return this.nullValue;
}
public void setNullValue(String nullValue) {
this.nullValue = nullValue;
}
public static class Hidden { public static class Hidden {
private String mine = "mySecret"; private String mine = "mySecret";

@ -30,8 +30,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec; 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.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.MapperFeature; 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.PropertyNamingStrategy.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.SerializerProvider; 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.module.SimpleModule;
import com.fasterxml.jackson.databind.util.StdDateFormat; import com.fasterxml.jackson.databind.util.StdDateFormat;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; 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.Import;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -447,12 +445,10 @@ public class JacksonAutoConfigurationTests {
Class<?>... configClasses) { Class<?>... configClasses) {
this.context.register(configClasses); this.context.register(configClasses);
this.context.refresh(); this.context.refresh();
DeserializationConfig deserializationConfig = this.context Annotated annotated = mock(Annotated.class);
.getBean(ObjectMapper.class).getDeserializationConfig(); Mode mode = this.context.getBean(ObjectMapper.class).getDeserializationConfig()
AnnotationIntrospector annotationIntrospector = deserializationConfig .getAnnotationIntrospector().findCreatorBinding(annotated);
.getAnnotationIntrospector().allIntrospectors().iterator().next(); assertThat(mode).isEqualTo(expectedMode);
assertThat(ReflectionTestUtils.getField(annotationIntrospector, "creatorBinding"))
.isEqualTo(expectedMode);
} }
public static class MyDateFormat extends SimpleDateFormat { public static class MyDateFormat extends SimpleDateFormat {

@ -94,7 +94,7 @@
<httpclient.version>4.5.3</httpclient.version> <httpclient.version>4.5.3</httpclient.version>
<httpcore.version>4.4.6</httpcore.version> <httpcore.version>4.4.6</httpcore.version>
<infinispan.version>8.2.6.Final</infinispan.version> <infinispan.version>8.2.6.Final</infinispan.version>
<jackson.version>2.9.0.pr1</jackson.version> <jackson.version>2.8.7</jackson.version>
<janino.version>2.7.8</janino.version> <janino.version>2.7.8</janino.version>
<javassist.version>3.21.0-GA</javassist.version> <!-- Same as Hibernate --> <javassist.version>3.21.0-GA</javassist.version> <!-- Same as Hibernate -->
<javax-cache.version>1.0.0</javax-cache.version> <javax-cache.version>1.0.0</javax-cache.version>

Loading…
Cancel
Save