Lombok 和 jackson - Conflicting/ambiguous 属性 名称定义
Lombok and jackson - Conflicting/ambiguous property name definitions
我收到警告消息:
com.fasterxml.jackson.databind.JsonMappingException: Conflicting/ambiguous property name definitions (implicit name 'balance'): found multiple explicit names: [{}Balance, Balance], but also implicit accessor: [method ResponseVO#getBalance(0 params)][visible=true,ignore=false,explicitName=false]
我有最新的 lombok 1.18.10 和 fasterxml.jackson-version 2.7.5
我找到了 similar issue 但它应该已在 2.7.4 中修复(已关闭)
Jackson 2.7.1 and Lombok: 'Conflicting/ambiguous property name definitions' #1122
I think this can be changed for 2.7.4 after all, can fix this.
代码:
@Data
@AllArgsConstructor(access = AccessLevel.PUBLIC)
@NoArgsConstructor
public class ResponseVO implements Serializable {
private static final long serialVersionUID = 1;
@JacksonXmlProperty(localName = "Balance")
@JsonProperty("Balance")
@JacksonXmlElementWrapper(useWrapping = false)
List<BalanceResponseVO> balance;
是相关警告吗?我怎么能fix/remove这个警告?
似乎新的 Lombok 版本添加了 @JsonProperty("Balance")
来生成 setter 并且造成了这种混乱
编辑
当我删除 @JsonProperty("Balance")
时问题已解决,这在我的情况下实际上是不需要的
我们升级了 Lombok 版本,它现在添加了 @JsonProperty("Balance")
也生成了 setter
这个副本 @JsonProperty
在日志中创建了一个 WARN,并且也未能创建响应(无一例外)
我删除了 @JsonProperty("Balance")
,在我的情况下实际上是 redundant/unneeded,它有效
- 请注意更改为
private
并未解决问题
FEATURE: Lombok now knows exactly how to treat @com.fasterxml.jackson.annotation.JsonProperty and will copy it to the right places for example when making builders. Issue #1961 Issue #1981
我收到警告消息:
com.fasterxml.jackson.databind.JsonMappingException: Conflicting/ambiguous property name definitions (implicit name 'balance'): found multiple explicit names: [{}Balance, Balance], but also implicit accessor: [method ResponseVO#getBalance(0 params)][visible=true,ignore=false,explicitName=false]
我有最新的 lombok 1.18.10 和 fasterxml.jackson-version 2.7.5
我找到了 similar issue 但它应该已在 2.7.4 中修复(已关闭)
Jackson 2.7.1 and Lombok: 'Conflicting/ambiguous property name definitions' #1122
I think this can be changed for 2.7.4 after all, can fix this.
代码:
@Data
@AllArgsConstructor(access = AccessLevel.PUBLIC)
@NoArgsConstructor
public class ResponseVO implements Serializable {
private static final long serialVersionUID = 1;
@JacksonXmlProperty(localName = "Balance")
@JsonProperty("Balance")
@JacksonXmlElementWrapper(useWrapping = false)
List<BalanceResponseVO> balance;
是相关警告吗?我怎么能fix/remove这个警告?
似乎新的 Lombok 版本添加了 @JsonProperty("Balance")
来生成 setter 并且造成了这种混乱
编辑
当我删除 @JsonProperty("Balance")
时问题已解决,这在我的情况下实际上是不需要的
我们升级了 Lombok 版本,它现在添加了 @JsonProperty("Balance")
也生成了 setter
这个副本 @JsonProperty
在日志中创建了一个 WARN,并且也未能创建响应(无一例外)
我删除了 @JsonProperty("Balance")
,在我的情况下实际上是 redundant/unneeded,它有效
- 请注意更改为
private
并未解决问题
FEATURE: Lombok now knows exactly how to treat @com.fasterxml.jackson.annotation.JsonProperty and will copy it to the right places for example when making builders. Issue #1961 Issue #1981