I have a problem with deserializing json using jackson. I am using spring-boot framework and there I have jackson dependecies, so this is not an issue.
In one project A I have a class User and in project B (which is referencing project A through maven dependency), I have an extension class of the User class, the UserExtension class.
When I test the GET method using Swagger, I get the following exception: "No converter found for return value of type:..."
I tried adding manually getters and setters for the User fields in the UserExtension class, but it didn't work. Do you have any suggestion of what I could change? Is there a way to solve this without writing custom Json Serializors and Deserializors?
@JsonSerialize
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public class User {
private String id;
private String name;
}
@JsonSerialize
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public class UserExtension {
private String email;
private String quote;
@JsonUnwrapped
@NotNull
private User user;
public String getId() {
return user.getId();
}
public String getName() {
return user.getName();
}
public void setId(String id) {
user.setId(id);
}
public void setName(String name) {
user.setName(name);
}
}