It is invalid to use JSR-303 to verify @ Valid in SringMVC

introduced jar package:
< dependency >

<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>

< / dependency >
< dependency >

<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.1.Final</version>

< / dependency >
Spring version 4.3
entity class:
public class Spitter {

//private Long id;

//@NotNull
@Length(min=5,message="5")
private String username;

//@NotNull
@Length(min=5,message="5")
private String password;

//@NotNull
@Length(min=2,message="5")
private String firstName;

//@NotNull
@Length(min=2,message="5")
private String lastName;

public Spitter() {
}

Controller:
RequestMapping (value = "/ register", method = POST)
public String processRegistration (@ Validated Spitter spitter, BindingResult errors) {

if(errors.hasErrors()){
    return "registerForm";
}
System.out.println("has no errors");
spitterRepository.save(spitter);
return "redirect:/spitter/" + spitter.getUsername();

}
debug:

clipboard.png

Why not report an error when it is clear that the length does not match

Dec.02,2021
Try

@ Length to @ Size?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b3b4-2b9f5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b3b4-2b9f5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?