Java 类org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer 实例源码

项目:jigsaw-payment    文件:ProtobufConfiguration.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer configProtobufSerializer() {
    return new Jackson2ObjectMapperBuilderCustomizer() {

        @Override
        public void customize(
                Jackson2ObjectMapperBuilder builder) {
            builder.serializerByType(Message.class, new JsonSerializer<Message>(){

                @Override
                public void serialize(Message message, JsonGenerator generator,
                        SerializerProvider provider) throws IOException {
                    if(message == null)
                        return;
                    JsonJacksonFormat format = new JsonJacksonFormat();
                    format.print(message, generator);
                }});

        }
    };
}
项目:spring-cloud-starter-bootstrap    文件:DefaultJacksonConfiguration.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilder() {

    return builder -> {
        TimeZone tz = TimeZone.getTimeZone("UTC");
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
        df.setTimeZone(tz);

        builder
                .failOnEmptyBeans(false)
                .failOnUnknownProperties(false)
                .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
                .dateFormat(df);

    };
}
项目:jigsaw-payment    文件:TimerAutoConfiguration.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer configBuilder() {
    return new Jackson2ObjectMapperBuilderCustomizer() {

        @Override
        public void customize(
                Jackson2ObjectMapperBuilder builder) {
            builder.findModulesViaServiceLoader(true)
                    .dateFormat(new SimpleDateFormat("yyyy-MM-dd"));

        }

    };
}
项目:camel-springboot    文件:AppConfig.java   
/**
 * Customize the Spring auto-configured Jackson ObjectMapper (not used by Camel rest).
 * In this example we set marshaling rules for BasicDataSource.class
 */
@Bean
public Jackson2ObjectMapperBuilderCustomizer customObjectMapper() {
    return new Jackson2ObjectMapperBuilderCustomizer() {
        @Override
        public void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) {
            jacksonObjectMapperBuilder
                    .mixIn(BasicDataSource.class, BasicDataSourceMixIn.class)
                    .indentOutput(true);
        }
    };
}
项目:jira-sync    文件:JiraSyncApplication.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer mapperBuilderCustomizer() {
    return mapperBuilder -> {
        mapperBuilder.serializationInclusion(Include.NON_NULL);
        mapperBuilder.featuresToEnable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    };
}
项目:jhipster-rethinkdb-app    文件:JacksonConfiguration.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomizer() {
    return new Jackson2ObjectMapperBuilderCustomizer() {
        @Override
        public void customize(Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder) {
            jackson2ObjectMapperBuilder.serializers(new ZonedDateTimeSerializer(ISO_FIXED_FORMAT));
        }
    };
}
项目:vidada-server    文件:JacksonConfiguration.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomConfig() {
    return builder -> {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
        df.setTimeZone(TimeZone.getTimeZone("UTC"));

        builder.failOnEmptyBeans(false)
            .failOnUnknownProperties(false)
            .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
            .dateFormat(df);
    };
}
项目:ehcache3-samples    文件:JacksonConfiguration.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomizer() {
    return jackson2ObjectMapperBuilder -> jackson2ObjectMapperBuilder.serializers(new ZonedDateTimeSerializer(ISO_FIXED_FORMAT));
}
项目:prove.jwt    文件:JacksonConfiguration.java   
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonCustomizer() {
    return jackson2ObjectMapperBuilder -> jackson2ObjectMapperBuilder.serializers(new ZonedDateTimeSerializer(ISO_FIXED_FORMAT));
}