2.43. gson
将 POJO 发布到 JSON 并使用 Gson
2.43.1. 什么是内部
有关用法和配置详情,请参阅上述链接。
2.43.2. Maven 协调
在 https://code.quarkus.io 中使用这个扩展创建新项目
或者将协调添加到现有项目中:
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-gson</artifactId> </dependency>
2.43.3. 其他 Camel Quarkus 配置
2.43.3.1. 原生模式的 marshaling/Unmarshaling 对象
当原生模式下对对象进行 marshaling/unmarshaling 对象时,需要注册所有序列化类来反映。因此,当使用 GsonDataFormat.setUnmarshalType (…)
, GsonDataFormat.setUnmarshalTypeName (…)
甚至 GsonDataFormat.setUnmarshalGenericType (…)
, unmarshal 类型,以及子字段类型。请参见此集成测试中的工作示例。