我使用骆驼和杰克逊用json解组字符串
{"GUID":"123"}
... .unmarshal().json(JsonLibrary.Jackson, TestPojo.class)
还有哈瓦波乔
TestPojo {
@JsonProperty("GUID)
private String guid;
@JsonProperty("GUID")
public String getGuid(){
return guid;
}
@JsonProperty("GUID")
public String setGuid(){
return guid;
}
}
但是有这个例外:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "GUID" (class package.TestPojo), not marked as ignorable (1 known properties: "guid")
我用处理器测试了路线,效果很好
.process(e -> {
ObjectMapper mapper = new ObjectMapper();
e.getIn().setBody(mapper.readValue(e.getIn().getBody(String.class),TestPojo.class));
})
我做错了什么?