Hi, we use Lombok and Jackson. Our DTOs have a bit weird setup:

class SomeDTO {
    @JsonIgnore
    private int id;

    @JsonProperty("id")
    private int uid;
}

DropWizard 1.3.1 needs jackson-databind (otherwise throws 
NoClassDefException), so I have added it. 
After upgrading Jackson to 2.9.5 (which Dw uses), Jackson (since 2.9.2) 
started to fail to load the models when creating the ObjectMapper, 
complaining about duplicate property "id".

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: 
Duplicate creator property "id" (index 0 vs 1)
 at [Source: (String)"{
  "description": "patched description"}"; line: 1, column: 1]
        at com.fasterxml.jackson.databind.exc.InvalidDefinitionExc



This is because we use Lombok's @Builder, which needs @AllArgsConstructor, 
and Jackson started to take this constructor into account as JSON creator I 
assume.

The only way to fix it I have found was to get rid of the @Builder and 
@AllArgsConstructor. That way, Jackson works fine.

I don't know how Jackson internally works. Is there some option or 
workaround I could use to get over that duplicated id issue?

Thanks!
Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to