如下代码,有路径参数与查询参数,我想同时封装到SubjectRequestParams 对象上,有没有办法
@GetMapping(path = "/{subjectCode}")
public ResponseEntity<?> findSubject(SubjectRequestParams requestParams){
}
1 回答
米琪卡哇伊
TA贡献1998条经验 获得超6个赞
@GetMapping(path = "/{subjectCode}")
public ResponseEntity<?> findSubject(@ModelAttribute("subjectCode") SubjectRequestParams requestParams){
}
这个注解就行了,如果多个参数
@GetMapping(path = "/{subjectCode}/{message}")
public ResponseEntity<?> findSubject(@ModelAttribute SubjectRequestParams requestParams){
}
添加回答
举报
0/150
提交
取消