Example usage for org.springframework.http.converter.json Jackson2ObjectMapperFactoryBean setFeaturesToDisable

List of usage examples for org.springframework.http.converter.json Jackson2ObjectMapperFactoryBean setFeaturesToDisable

Introduction

In this page you can find the example usage for org.springframework.http.converter.json Jackson2ObjectMapperFactoryBean setFeaturesToDisable.

Prototype

public void setFeaturesToDisable(Object... featuresToDisable) 

Source Link

Document

Specify features to disable.

Usage

From source file:org.spring.data.gemfire.rest.GemFireRestInterfaceTest.java

protected ObjectMapper getObjectMapper() {
    if (objectMapper == null) {
        Jackson2ObjectMapperFactoryBean objectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean();

        objectMapperFactoryBean.setFailOnEmptyBeans(true);
        objectMapperFactoryBean.setFeaturesToEnable(Feature.ALLOW_COMMENTS);
        objectMapperFactoryBean.setFeaturesToEnable(Feature.ALLOW_SINGLE_QUOTES);
        objectMapperFactoryBean.setFeaturesToEnable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
        objectMapperFactoryBean.setFeaturesToDisable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
        objectMapperFactoryBean.setIndentOutput(true);
        objectMapperFactoryBean.setSimpleDateFormat("MM/dd/yyyy");
        objectMapperFactoryBean.afterPropertiesSet();

        objectMapper = objectMapperFactoryBean.getObject();
    }//from  w  w w. jav a 2  s .c  o  m

    return objectMapper;
}