Post

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
This post is licensed under CC BY 4.0 by the author.