0

when using restdsl in camel, I can see how to configure some feature :

    restConfiguration().component("jetty")
            .host("localhost")
            .port("8889")
            .bindingMode(RestBindingMode.json)
            .dataFormatProperty(....);

but cannot see how to configure modules specific to jackson. like for these:

    <dependency>
        <groupId>com.fasterxml.jackson.module</groupId>
        <artifactId>jackson-module-parameter-names</artifactId>
        <version>2.7.5</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-jdk8</artifactId>
        <version>2.7.5</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-jsr310</artifactId>
        <version>2.6.7</version>
    </dependency>

I need this to get java.time.LocalDate serialized correctly.

Cedric Dumont
  • 1,009
  • 17
  • 38
  • I think part of the answer can be found here : http://stackoverflow.com/questions/33397359/how-to-configure-jackson-objectmapper-for-camel-in-spring-boot – Cedric Dumont Dec 21 '16 at 10:04

1 Answers1

0

I did the same as related here : How to configure Jackson ObjectMapper for Camel in Spring Boot

@Produces
@Named("json-jackson")
public JacksonDataFormat getjacksonDataFormat() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.findAndRegisterModules();

    JacksonDataFormat formatter = new JacksonDataFormat(mapper, (Class)null);

    return formatter;
}

Because I am using camelcdicontext, the bean is lookedup here. I don't know how this could be achieved for the defaultCamelcontext for instance

Community
  • 1
  • 1
Cedric Dumont
  • 1,009
  • 17
  • 38