ObjectMapper can't deserialize without default constructor after upgrade to Spring Boot 2

前端 未结 7 1624
予麋鹿
予麋鹿 2020-12-24 01:42

I have following DTOs:

@Value
public class PracticeResults {
    @NotNull
    Map wordAnswers;
}

@Value
public class ProfileMetaDto {

         


        
7条回答
  •  攒了一身酷
    2020-12-24 01:42

    Due to breaking changes in Lombok version 1.16.20 you need to set the following property in your lombok.config file (if you don't have this file you can create it in your project root):

    lombok.anyConstructor.addConstructorProperties=true
    

    This is described in the Lombok changelog: https://projectlombok.org/changelog.

    After that the @Value should be accepted again by Jackson.

    You may be interested in following the related GitHub issue here, although it's about @Data: https://github.com/rzwitserloot/lombok/issues/1563

提交回复
热议问题