Set Jackson DEFAULT_VIEW_INCLUSION property to false by default
Issue: SPR-12179
This commit is contained in:
@@ -173,8 +173,8 @@ public class MvcNamespaceTests {
|
||||
for(HttpMessageConverter<?> converter : converters) {
|
||||
if(converter instanceof AbstractJackson2HttpMessageConverter) {
|
||||
ObjectMapper objectMapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper();
|
||||
assertTrue(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertTrue(objectMapper.getSerializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getSerializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
|
||||
if(converter instanceof MappingJackson2XmlHttpMessageConverter) {
|
||||
assertEquals(XmlMapper.class, objectMapper.getClass());
|
||||
|
||||
@@ -162,8 +162,8 @@ public class WebMvcConfigurationSupportExtensionTests {
|
||||
assertEquals(1, adapter.getMessageConverters().size());
|
||||
assertEquals(MappingJackson2HttpMessageConverter.class, adapter.getMessageConverters().get(0).getClass());
|
||||
ObjectMapper objectMapper = ((MappingJackson2HttpMessageConverter)adapter.getMessageConverters().get(0)).getObjectMapper();
|
||||
assertTrue(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertTrue(objectMapper.getSerializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getSerializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
|
||||
|
||||
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(adapter);
|
||||
|
||||
@@ -162,8 +162,8 @@ public class WebMvcConfigurationSupportTests {
|
||||
for(HttpMessageConverter<?> converter : converters) {
|
||||
if(converter instanceof AbstractJackson2HttpMessageConverter) {
|
||||
ObjectMapper objectMapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper();
|
||||
assertTrue(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertTrue(objectMapper.getSerializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getSerializationConfig().isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION));
|
||||
assertFalse(objectMapper.getDeserializationConfig().isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
|
||||
if(converter instanceof MappingJackson2XmlHttpMessageConverter) {
|
||||
assertEquals(XmlMapper.class, objectMapper.getClass());
|
||||
|
||||
@@ -322,7 +322,7 @@ public class RequestResponseBodyMethodProcessorTests {
|
||||
String content = this.servletResponse.getContentAsString();
|
||||
assertFalse(content.contains("\"withView1\":\"with\""));
|
||||
assertTrue(content.contains("\"withView2\":\"with\""));
|
||||
assertTrue(content.contains("\"withoutView\":\"without\""));
|
||||
assertFalse(content.contains("\"withoutView\":\"without\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -343,7 +343,7 @@ public class RequestResponseBodyMethodProcessorTests {
|
||||
String content = this.servletResponse.getContentAsString();
|
||||
assertFalse(content.contains("\"withView1\":\"with\""));
|
||||
assertTrue(content.contains("\"withView2\":\"with\""));
|
||||
assertTrue(content.contains("\"withoutView\":\"without\""));
|
||||
assertFalse(content.contains("\"withoutView\":\"without\""));
|
||||
}
|
||||
|
||||
// SPR-12149
|
||||
@@ -366,7 +366,7 @@ public class RequestResponseBodyMethodProcessorTests {
|
||||
String content = this.servletResponse.getContentAsString();
|
||||
assertFalse(content.contains("<withView1>with</withView1>"));
|
||||
assertTrue(content.contains("<withView2>with</withView2>"));
|
||||
assertTrue(content.contains("<withoutView>without</withoutView>"));
|
||||
assertFalse(content.contains("<withoutView>without</withoutView>"));
|
||||
}
|
||||
|
||||
// SPR-12149
|
||||
@@ -389,7 +389,7 @@ public class RequestResponseBodyMethodProcessorTests {
|
||||
String content = this.servletResponse.getContentAsString();
|
||||
assertFalse(content.contains("<withView1>with</withView1>"));
|
||||
assertTrue(content.contains("<withView2>with</withView2>"));
|
||||
assertTrue(content.contains("<withoutView>without</withoutView>"));
|
||||
assertFalse(content.contains("<withoutView>without</withoutView>"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user