Performance: @NotNull, @NotBlank, @NotEmpty
These annotations affect server-side validation speed and response time but have minimal impact on frontend rendering or page load.
Jump into concepts and practice - no test required
@NotBlank private String name; @NotBlank private String email; @NotEmpty private List<String> tags;
@NotNull private String name; @NotBlank private String email; @NotEmpty private List<String> tags;
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using @NotNull, @NotBlank, @NotEmpty appropriately on server-side | 0 | 0 | 0 | [OK] Good |
| Redundant or unnecessary validation annotations on same fields | 0 | 0 | 0 | [!] OK |
| Client-side validation only without server validation | 0 | 0 | 0 | [X] Bad (security risk) |
@NotEmpty private List<String> tags;
tags is set to an empty list during validation?@NotBlank private String title;
title will cause validation to fail with @NotBlank but pass with @NotEmpty?description that must not be null, empty, or only spaces, but also must allow strings like "0" or "false". Which annotation should you use in Spring Boot?