As javax validations not supported in springboot 3.0. How to do field validations using Jakarta. imports
import jakarta.persistence.Entity;
import jakarta.persistence.NotNull;
import jakarta.persistence.Pattern;
@Entity
@Data
public class Users{
@NotNull
@NotEmpty
Private String username;
@Pattern
Private String username;
@NotNull
Private String username;
}
主计长
public class Users主计长{
public void saveUser(@Valid @RequestBody Users user){
repo.save();
}
}