Home > database >  Java Spring deserialize object with @Value annotation
Java Spring deserialize object with @Value annotation

Time:07-08

I have a class that represents request from front end to backend, and i want to annotate it with @Value so it can't be changed, but then I can't have NoArgsConstructor and when server is processing such request it fails with "cannot deserialize from Object value (no delegate- or property-based Creator)". I tried to use "lombok.noArgsConstructor.extraPrivate=true" but providing default value for each entry in class is not what I want. Is there any way to fix deserialization issue and keep @Value annotation instead of using @Data and @NoArgsConstructor?

CodePudding user response:

I am using combination of

@Value
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
@AllArgsConstructor(staticName = "of")

because I create those requests in tests using static of

  • Related