IIRC @Valid isn't a Spring annotation but a JSR-303 annotation (which is the Bean Validation standard). What it does is it basically checks if the data that you send to the method is valid or not (it will validate the scriptFile for you).
@Valid annotation is commonly used within the Bean Validation API scope. It’s primarily employed to enable form validation or validation of model objects. //Below are my pojo classes public class ...
In the example code snippets of the question, @Valid and @Validated make no difference. But if the @RequestBody is annotated with a List object, or is a string value annotated by @RequestParam, the validation will not take effect. We can use the @Validated 's method-level validation capability to make it work. To achieve this, the key point is to place @Validated on the class. This may be ...