Package halfpipe.jackson

Source Code of halfpipe.jackson.JacksonAutoConfig

package halfpipe.jackson;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.fasterxml.jackson.datatype.jsr310.JSR310Module;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
* User: spencergibb
* Date: 5/1/14
* Time: 9:19 AM
*/
@Configuration
public class JacksonAutoConfig {

    @Autowired
    ObjectMapper objectMapper;

    @PostConstruct
    public void init() {
        //TODO auto config configurer ala boot
        objectMapper.registerModule(new GuavaModule());
        objectMapper.registerModule(new GuavaExtrasModule());
        objectMapper.registerModule(new JodaModule());
        objectMapper.registerModule(new JSR310Module());
        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    }

    @Bean
    public ObjectMapperProvider jerseyObjectMapperProvider() {
        return new ObjectMapperProvider(objectMapper);
    }
}
TOP

Related Classes of halfpipe.jackson.JacksonAutoConfig

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.