백엔드
[Mybatis] @RequestParam 사용하기
s_eonxx
2022. 9. 20. 08:10
controller에서 분명 DTO의 파라미터와 mapper.xml의 값을 같게 사용하였는데 에러가 발생했다.
데이터베이스의 모든 컬럼을 not null로 설정해줬고 필요하다면 default 값도 설정해 놓았는데 생긴 오류였다.
내용)
BindingException: Parameter '...' not found. Available parameters are [arg2, arg1, arg0, param1, param2]
위는 컴파일러가 파라미터를 발견을 못해서 생기는 오류로, controller에 @RequestParam("userid")와 같이 직접 파라미터 명시를 해줘야 한다.
@PostMapping("/users/login")
public void postlogin(@RequestParam("userid") String userid, @RequestParam("userpw") ...)