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

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

I have following DTOs:

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

@Value
public class ProfileMetaDto {

         


        
相关标签:
7条回答
  • 2020-12-24 02:06

    I faced this problem, but my solution did not involve adding this: (mode = JsonCreator.Mode.PROPERTIES)

    What really solved my problem was the @JsonProperty within the Constructor.

    My final result was this:

    @Value
    public class ServerTimeResponse {
    
        long serverTime;
    
        @JsonCreator
        public ServerTimeResponse(@JsonProperty("serverTime") long serverTime) {
            this.serverTime = serverTime;
        }
    
    }
    
    0 讨论(0)
提交回复
热议问题