SPRING CONCEPTS
Bean Validation
Spring Concepts / Bean Validation
Bean Validation checks declared constraints on Java values.
Understand the idea
@NotBlank rejects null, empty, and whitespace-only strings. @Size bounds length. @NotNull rejects missing values. @Valid tells the web layer to evaluate constraints on an incoming object. Browser required and maxlength are usability aids, not substitutes for server checks.
A concrete example
@NotBlank
@Size(max = 120)
private String title;In the application
MVC renders field errors with BindingResult. The APIs return HTTP 400 with details through ApiErrors.
Annotations alone do not validate every direct call to a Java method. Use the appropriate validation entry point.