I found this example how to validate path variable: https://www.mkyong.com/spring-boot/spring-rest-validation-example/
@PostMapping(value = "/payment/{unique_transaction_id}")
public ResponseEntity<StringResponseDTO> handleWpfMessage(@PathVariable("unique_transaction_id") @Valid @Max(32) String unique_transaction_id) throws Exception {
Can I add @Valid infant of the limitation for String @Max(32) or I have to add @Validated at class level as it is shown in the tutorial?