现在我有这样的代码:
@RestController
public class ChildController {
@RequestMapping(value = "/parents/{parentId}/addChild", method = RequestMethod.POST)
public void addChild(@RequestBody ChildDTO child, @PathVariable Long parentId) {
child.setParentId(parentId);
//...
}
}
class ChildDTO {
private Long parentId;
private String name;
private double weight;
private double height;
//setters ang getters
}
有没有办法在子对象中映射parentId而不在方法体中调用setter? 我需要它为我的Aspect @Before逻辑