포스트

2021-05-28-TIL

2021-05-28-TIL

@RequestParam to be nullable

1
2
3
4
@GetMapping
public searchDto search(@RequestParam(name = "check-in", required = false) String checkIn) {
            ...
}

기본적으로 파라미터는 required = true값을 갖는다. 따라서 파라미터가 null이라도 동작하도록 하려면 required = false을 추가해주어야 한다.

  • https://stackoverflow.com/questions/12296642/is-it-possible-to-have-empty-requestparam-values-use-the-defaultvalue

String to LocalDate

  • https://stackoverflow.com/questions/8746084/string-to-localdate/22538939#22538939
이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.

댓글

아직 댓글이 없습니다