I have a spring service that receives a header parameter like this:
@RequestHeader(name = "token", required = true) String token
but it only validates if the header is present and not if it is blank or just spaces,
if I add @NotBlank or @Valid makes no change,
How can I annotate a header parameter so it is validated for blank strings?
thnx in advance,
Validate Request Header docs
The spring boot allows to validate a request header as like other request parameters. The annotation
@Validatedis used to validate the request header. And add@NotBlankfor validation