Hi,

The "json" and "outJson" variables you mentioned will *not* resolve to the
same Java object (because of Camel Injector being invoked here behind the
scenes while resolving), well almost always ... depending if e.g. an object
under the name "json-jackson" is already bound to the Camel registery which
isn't really typical. The following code snippet should make both cases
clear to you:

        CamelContext context = new DefaultCamelContext();

        DataFormat first = context.resolveDataFormat("json-jackson");
        DataFormat second = context.resolveDataFormat("json-jackson");

        System.out.println(first != second); // true

        JndiRegistry registry = new JndiRegistry();
        registry.bind("json-jackson", new
org.apache.camel.component.jackson.JacksonDataFormat());
        ((DefaultCamelContext) context).setRegistry(registry);

        DataFormat third = context.resolveDataFormat("json-jackson");
        DataFormat fourth = context.resolveDataFormat("json-jackson");

        System.out.println(third == fourth); // true

        System.out.println(third != first); // true
        System.out.println(fourth != first); // true

If interested, looking into the different implementations of Camel’s
DataFormatResolver should clarify this to you, specially the
DefaultDataFormatResolver one.

Babak 

sohrab wrote
> I was just looking through the latest code for
> org.apache.camel.model.rest.RestBindingDefinition and I am not quite sure
> how this works so I'd appreciate if someone can explain it to me. 
> 
> createProcessor() method looks up both JSON data formats using the same
> name:
> 
> DataFormat json = context.resolveDataFormat(name);
> DataFormat outJson = context.resolveDataFormat(name);
> 
> And further down, it sets the properties for "json" and then "outJson".
> Now I am wondering if that name resolves to the same DataFormat object
> (especially when you have RestConfiguration.jsonDataFormat set), what
> stops setting "outJson" properties, such as unmarshalType, not overriding
> the properties we just set for "json"?





--
View this message in context: 
http://camel.465427.n5.nabble.com/RestBindingProcessor-JSON-Data-Format-Config-tp5757103p5757186.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to