我有这个代码:
@Controller
public class createUserController {
@RequestMapping(value = "/user/registerUser", method = RequestMethod.GET, produces = "application/json")
public ModelAndView createFleet(HttpServletRequest request, HttpServletResponse response, User user) {
ModelAndView model = new ModelAndView();
model.setView(new MappingJackson2JsonView());
model.addObject("userCreated", new UserCreateResponse(user.getId(), user.getAccessCode()));
return model;
}
}
回应:
{
"user": {
"id": null,
"userName": "3",
"password": "eccbc87e4b5ce2fe28308fd9f2a7baf3",
"email": "3",
"accessCode": "3"
},
"userCreated": {
"id": null,
"accessCode": "3"
}
}
我不希望主要用户包含在响应中。我只是想要减少的细节,所以我不会发回原始请求。我试过 .clear() 但这给出了 404 错误