First you dont need to have @Valid annotation for those class variables in UpdatePrintContracts . You can delete them.
To trigger validation of a @Controller input, simply annotate the input argument as @Valid or @Validated:
@RequestMapping(value=PATH_PRINT_CONTRACTS, method=RequestMethod.POST)
public ResponseEntity<?> printContracts(@Valid @RequestBody final UpdatePrintContracts updatePrintContracts) throws Exception {
Refer here for full understanding of validating models in spring boot.
And If you want to check that a string contains only specific characters, you must add anchors (^ for beginning of the string, $ for end of the string) to be sure that your pattern matches all the string.Curly brackets are only to write a quantity,
@Pattern(regexp = "^[\\p{Alnum}]{1,32}$")
Lastly i assume you have following jars in your classpath,
.validation-api.jar (contains the abstract API and the annotation scanner)
.hibernate-validator.jar (contains the concrete implementation)