Can't make Jackson and Lombok work together

后端 未结 14 1238
伪装坚强ぢ
伪装坚强ぢ 2020-11-27 13:48

I am experimenting in combining Jackson and Lombok. Those are my classes:

package testelombok;

import com.fasterxml         


        
相关标签:
14条回答
  • 2020-11-27 14:34

    @AllArgsConstructor(suppressConstructorProperties = true) is deprecated. Define lombok.anyConstructor.suppressConstructorProperties=true (https://projectlombok.org/features/configuration) and change POJO's lombok annotation from @Value to @Data + @NoArgsConstructor + @AllArgsConstructor works for me.

    0 讨论(0)
  • 2020-11-27 14:36

    You can get Jackson to play with just about anything if you use its "mixin" pattern. Basically, it gives you a way to add Jackson annotations onto an existing class without actually modifying that class. I'm leaning towards recommending it here rather than a Lombok solution because this is solves a problem Jackson is having with a Jackson feature, so it's more likely to work long-term.

    0 讨论(0)
提交回复
热议问题