Spring MVC / HTTP

@NotNull

Reject null independently of numeric constraints. Boot 4.0.10 companion project; source-reviewed, not executed.

Formal Syntax & Structure

java syntaxjava
@NotNull @Min(0) Integer quantity

Working Example

Example Snippetjava
package example.inventory;import jakarta.validation.constraints.*;public record CreateItem(@NotNull @Pattern(regexp="[A-Z0-9]{1,12}") String sku,                         @NotBlank @Size(max=80) String name,                         @NotNull @Min(0) @Max(10000) Integer quantity) {}
Java Reference