Example usage for org.springframework.http.converter.json Jackson2ObjectMapperBuilder defaultViewInclusion

List of usage examples for org.springframework.http.converter.json Jackson2ObjectMapperBuilder defaultViewInclusion

Introduction

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

Prototype

public Jackson2ObjectMapperBuilder defaultViewInclusion(boolean defaultViewInclusion) 

Source Link

Document

Shortcut for MapperFeature#DEFAULT_VIEW_INCLUSION option.

Usage

From source file:org.devgateway.toolkit.web.spring.MvcConfig.java

@Bean
public Jackson2ObjectMapperBuilder objectMapperBuilder() {
    Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();

    SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));
    builder.serializationInclusion(Include.NON_EMPTY).dateFormat(dateFormatGmt);
    builder.serializerByType(GeoJsonPoint.class, new GeoJsonPointSerializer());
    builder.serializerByType(ObjectId.class, new ToStringSerializer());
    builder.defaultViewInclusion(true);

    return builder;
}