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

required

val required: Boolean

Whether the session attribute is required.

Defaults to true, leading to an exception being thrown if the attribute is missing in the session or there is no session. Switch this to false if you prefer a null or Java 8 java.util.Optional if the attribute doesn't exist.