问题

某个post接口中传参vo,这个vo使用lombok的@Data注解,可能会报错

  1. Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
  2. Cannot construct instance of `com.gal.Foo` (no Creators, like
  3. default construct, exist): cannot deserialize from Object value
  4. (no delegate- or property-based Creator)

解决

添加这两个注解即可

  1. @NoArgsConstructor
  2. @AllArgsConstructor