Set Jackson DEFAULT_VIEW_INCLUSION property to false by default
Issue: SPR-12179
This commit is contained in:
@@ -80,7 +80,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
||||
public void defaultProperties() {
|
||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().build();
|
||||
assertNotNull(objectMapper);
|
||||
assertTrue(objectMapper.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
|
||||
assertTrue(objectMapper.isEnabled(MapperFeature.AUTO_DETECT_FIELDS));
|
||||
assertTrue(objectMapper.isEnabled(MapperFeature.AUTO_DETECT_GETTERS));
|
||||
@@ -240,7 +240,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
||||
assertTrue(objectMapper.getFactory().isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS));
|
||||
|
||||
assertFalse(objectMapper.getSerializationConfig().isEnabled(MapperFeature.AUTO_DETECT_GETTERS));
|
||||
assertTrue(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.AUTO_DETECT_FIELDS));
|
||||
assertFalse(objectMapper.getFactory().isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE));
|
||||
|
||||
@@ -259,7 +259,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
||||
assertTrue(objectMapper.getFactory().isEnabled(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS));
|
||||
|
||||
assertFalse(objectMapper.getSerializationConfig().isEnabled(MapperFeature.AUTO_DETECT_GETTERS));
|
||||
assertTrue(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.AUTO_DETECT_FIELDS));
|
||||
assertFalse(objectMapper.getFactory().isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE));
|
||||
|
||||
@@ -255,7 +255,7 @@ public class MappingJackson2HttpMessageConverterTests {
|
||||
String result = outputMessage.getBodyAsString(Charset.forName("UTF-8"));
|
||||
assertThat(result, containsString("\"withView1\":\"with\""));
|
||||
assertThat(result, not(containsString("\"withView2\":\"with\"")));
|
||||
assertThat(result, containsString("\"withoutView\":\"without\""));
|
||||
assertThat(result, not(containsString("\"withoutView\":\"without\"")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -288,7 +288,7 @@ public class MappingJackson2HttpMessageConverterTests {
|
||||
assertThat(result, endsWith(");"));
|
||||
assertThat(result, containsString("\"withView1\":\"with\""));
|
||||
assertThat(result, not(containsString("\"withView2\":\"with\"")));
|
||||
assertThat(result, containsString("\"withoutView\":\"without\""));
|
||||
assertThat(result, not(containsString("\"withoutView\":\"without\"")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public class MappingJackson2XmlHttpMessageConverterTests {
|
||||
String result = outputMessage.getBodyAsString(Charset.forName("UTF-8"));
|
||||
assertThat(result, containsString("<withView1>with</withView1>"));
|
||||
assertThat(result, not(containsString("<withView2>with</withView2>")));
|
||||
assertThat(result, containsString("<withoutView>without</withoutView>"));
|
||||
assertThat(result, not(containsString("<withoutView>without</withoutView>")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -226,7 +226,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
String s = template.postForObject(baseUrl + "/jsonpost", entity, String.class, "post");
|
||||
assertTrue(s.contains("\"with1\":\"with\""));
|
||||
assertFalse(s.contains("\"with2\":\"with\""));
|
||||
assertTrue(s.contains("\"without\":\"without\""));
|
||||
assertFalse(s.contains("\"without\":\"without\""));
|
||||
}
|
||||
|
||||
// SPR-12123
|
||||
|
||||
Reference in New Issue
Block a user