You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Yifan Wu <Yi...@sas.com.INVALID> on 2020/06/29 13:51:48 UTC

Making copy of ObjectMapper in JacksonDataFormat in Camel 2.25

Dear Camel team,

We have a question about the JacksonDataFormat in Camel 2.25. In JacksonDataFormat class doStart() method, it looks for the single ObjectMapper in the registry. If found, the single ObjectMapper instance would be used and be applied with properties in the JacksonDataFormat instance.

This behavior creates a couple of problems:

  1.  If Camel is used with Spring boot, spring boot would auto config a ObjectMapper with Spring boot namespace properties. By default, Camel JacksonDataFormat would use it and override the Spring boot configuration with Camel's properties.
  2.  If Camel has multiple steps of "marshal" or "unmarshal" in the routes and they have confliting settings, the last "marshal" or "unmarshal" step setting would take precedence.

I believe those are unexpected behaviors. The question is why JacksonDataFormat does not make a copy of the single ObjectMapper in the registry. In that way, each of them are configured independently.

Thanks
Yifan


Re: Making copy of ObjectMapper in JacksonDataFormat in Camel 2.25

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I think there may be an option to turn off the auto configuration of
the ObjectMapper in Camel.

On Mon, Jun 29, 2020 at 3:52 PM Yifan Wu <Yi...@sas.com.invalid> wrote:
>
> Dear Camel team,
>
> We have a question about the JacksonDataFormat in Camel 2.25. In JacksonDataFormat class doStart() method, it looks for the single ObjectMapper in the registry. If found, the single ObjectMapper instance would be used and be applied with properties in the JacksonDataFormat instance.
>
> This behavior creates a couple of problems:
>
>   1.  If Camel is used with Spring boot, spring boot would auto config a ObjectMapper with Spring boot namespace properties. By default, Camel JacksonDataFormat would use it and override the Spring boot configuration with Camel's properties.
>   2.  If Camel has multiple steps of "marshal" or "unmarshal" in the routes and they have confliting settings, the last "marshal" or "unmarshal" step setting would take precedence.
>
> I believe those are unexpected behaviors. The question is why JacksonDataFormat does not make a copy of the single ObjectMapper in the registry. In that way, each of them are configured independently.
>
> Thanks
> Yifan
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2