spring-framework / org.springframework.web.bind.annotation / RequestParam / required

required

val required: Boolean

Whether the parameter is required.

Defaults to true, leading to an exception being thrown if the parameter is missing in the request. Switch this to false if you prefer a null value if the parameter is not present in the request.

Alternatively, provide a #defaultValue, which implicitly sets this flag to false.