Java 类org.springframework.boot.jackson.JsonComponentModule 实例源码

项目:angularjs-springmvc-sample-boot    文件:Jackson2ObjectMapperConfig.java   
@Bean
public Jackson2ObjectMapperBuilder objectMapperBuilder(JsonComponentModule jsonComponentModule) {

    Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
        builder
//                .serializerByType(ZonedDateTime.class, new JsonSerializer<ZonedDateTime>() {
//                    @Override
//                    public void serialize(ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
//                        jsonGenerator.writeString(DateTimeFormatter.ISO_ZONED_DATE_TIME.format(zonedDateTime));
//                    }
//                })
            .serializationInclusion(JsonInclude.Include.NON_EMPTY)
            .featuresToDisable(
                    SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,
                    DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES,
                    DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
            )
            .featuresToEnable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
            .indentOutput(true)
            .modulesToInstall(jsonComponentModule);

    return builder;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JacksonAutoConfiguration.java   
@Bean
public JsonComponentModule jsonComponentModule() {
    return new JsonComponentModule();
}
项目:spring-boot-concourse    文件:JacksonAutoConfiguration.java   
@Bean
public JsonComponentModule jsonComponentModule() {
    return new JsonComponentModule();
}