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

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

Introduction

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

Prototype

public void setFailOnEmptyBeans(boolean failOnEmptyBeans) 

Source Link

Document

Shortcut for SerializationFeature#FAIL_ON_EMPTY_BEANS option.

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();
    }/* w  w w.  j  av  a 2 s .com*/

    return objectMapper;
}