Jackson deserialization fails after serializing an object using writeValueAsString

The proper way to solve this without a default constructor is to add JsonCreator and JsonProperty annotations to your class constructor.

class MyClass {

    String name;

    @JsonCreator
    MyClass(@JsonProperty("name") String name) {
        this.name = name;
    }
    ...
}

Jackson uses Getter and Setters to set values. So you need to modify your class:

class MyClass {

    String name;

    MyClass(String name) {
      this.name = name;
   }

   MyClass(){}

   public void setName(String name) {
     this.name = name;
   }

  public String getName(String name) {
     return this.name;
  }
}

if you are using loombok remove the @Builder annotation of the class, was my problem