반응형
Required request parameter 'memberNum' for method parameter type String is not present
모든 @RequestParam에서 생기는 오류 메세지는 아니다.
@Operation(summary = "학교 정보", description = "학교명 검색")
@GetMapping("/info")
public EduResponseDTO getSchoolInfo(@RequestParam String schoolName) {
SchoolInfoRequestDTO param = new SchoolInfoRequestDTO();
param.setSchoolName(schoolName);
return schoolService.getSchoolInfo(param);
}
새로운 객체에 파라미터를 담으면 괜찮다
@Operation(summary = "학생 정보", description = "학생 정보")
@GetMapping("/student-info")
public EduResponseDTO selectStudentInfo(@RequestParam String memberNum , @RequestParam String type) {
return schoolService.selectStudentInfo(memberNum, type);
}
하지만, 받아온 파라미터를 객체에 담지 않고 보내면 경고 로그를 볼 수 있다.
컨트롤러에서 GETMAPPING을 수행하는 함수들 중 서비스 단으로 넘길 때 dto에 담아서 가는 경우에는 발생 되지 않는 거 같고,
서비스 단으로 인자를 넘길 때 dto에 담지 않고 넘어 가는 경우에 발생 되는 것 같다.
해결방법
@RequestParam(required = false) String memberNum
반응형
'지식' 카테고리의 다른 글
TLSv1 was negotiated. Please update server and client to use TLSv1.2 at minimum. (0) | 2023.03.23 |
---|---|
Error parsing HTTP request header 에러 오류 (0) | 2023.03.23 |
웹 사이트에 접속 과정 일 (0) | 2023.03.23 |
RESTful API 의미 예제 예시 이해 명세서 (0) | 2023.03.23 |
컴파일 언어와 스크립트 언어 차이 (0) | 2023.03.22 |
댓글