Details
-
New Feature
-
Status: Resolved
-
Minor
-
Resolution: Information Provided
-
3.7.1
-
None
-
None
-
Camel 3.7+
-
Patch Available
-
Unknown
-
Patch
Description
The Java DSL offers a simple way to get started marshalling and unmarshaling objects mid route by:
.unmarshal().json(JsonLibrary.Jackson, Map.class)
In 3.x an option was added to allow Jackson to automatically discover ObjectMappers in the Camel registry:
autoDiscoverObjectMapper
This is very convenient to apply global Object mapper configurations to an entire application. However it's defaulted to false and there does not appear to be a way to set this option in the Java DSL without replacing the above code with a DataFormat Object
EX
JacksonDataFormat format = new JacksonDataFormat(Map.class); format.setAutoDiscoverObjectMapper(true); .unmarshal(format);
This is a big change to make all over the project.
I'd like to propose being able to set this option globally in the camel context with the GlobalOptions
EX
getContext().getGlobalOptions().put("jackson.json.autoDiscoverObjectMapper", "true");
Then use the Java DSL as is to a ObjectMapper that is already bound in the registry. Would this be an acceptable approach? Other options I'm missing.
I have a patch with a suggested implementation.
Attachments
Issue Links
- links to