Camel Rest DSL无法识别JsonProperty访问

Camel Rest DSL无法识别JsonProperty访问,rest,apache-camel,Rest,Apache Camel,我正在使用Camel Rest DSL构建我的Rest服务,但它似乎不识别JsonProperty注释 我有一个财产,比如: class Test { private int id; @JsonProperty(access = Access.READ_ONLY) private String text; } 其余的定义是: <rests xmlns="http://camel.apache.org/schema/spring"> <res

我正在使用Camel Rest DSL构建我的Rest服务,但它似乎不识别JsonProperty注释

我有一个财产,比如:

class Test {

    private int id;

    @JsonProperty(access = Access.READ_ONLY)
    private String text;
}
其余的定义是:

<rests xmlns="http://camel.apache.org/schema/spring">
    <rest consumes="application/json" produces="application/json" path="/api/v1">
        <post bindingMode="json" type="Test" uri="/path">
            <route>
                .....
            </route>
        </post>
    </rest>
</rests>
文本字段也正在初始化

我错过了什么


Thx

Jackson的@JsonProperty(access=access.READ_ONLY)中有一个bug。 有关更多信息,请参阅:

bug报告中提到了两种解决方法:

  • “唯一有帮助的是创建一个setter并用@JsonIgnore注释它”
  • @JsonIgnoreProperties(value=“some_field”,allowGetters=true,allowSetters=false)
{
    "id":2,
    "text":"asd"
}