Answer the question
In order to leave comments, you need to log in
How to avoid infinite recursion when rendering json in spring?
Hello. Help, please, to solve a problem. There are two entities, each containing a list of the other.
public class UserDTO implements Serializable {
private String name;
private String secondName;
private String email;
private List<Group> groups;
}
public class GroupDTO {
private String title;
private List<User> users;
@RequestMapping(value = "/getAllUsers", method = RequestMethod.GET)
@ResponseBody
public UserDto getAllUsers(HttpServletRequest req) {
return userService.getUser("1");
}
@JsonBackReference
@JsonManagedReference
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question