Validating in spring mvc

I have issues using jsr 349 validator and hibernate validator implementation to validate user input using spring form in my spring mvc project. i used maven repository javax-validator api and hibernate-validator but it still wasnt validating the user input after i declared the bean validators using @notblank in the model and also @valid in the controller. pls what do i do?

`@PostMapping("/savestudent")
public String saveStudent(@Valid StudentDTOModel studentDTO, BindingResult result) {

	if (studentDTO.getId() == 0) {

		if (result.hasErrors()) {
			System.out.println(result);
			return "add-student";
		} else {
			System.out.println("successfull");
			services.saveStudent(studentDTO);
		}
	} else {

		if (result.hasErrors())
			return "add-student";
		else
			System.out.println("successfull");
			services.updateStudent(studentDTO);
	}

	return "redirect:/studentlist";
}`

`package com.schoolmanagement.api;

import javax.validation.constraints.NotBlank;

public class StudentDTOModel {

private int id;

@NotBlank(message = " this field cannot be empty")
private String name;
@NotBlank(message = "Email cannot bew blank")
private String email;
private String country;
private Long mobile;

}

}
`

this is the pom.xml file.

`

javax.validation
validation-api
2.0.1.Final

	<dependency>
		<groupId>org.hibernate.validator</groupId>
		<artifactId>hibernate-validator-annotation-processor</artifactId>
		<version>7.0.2.Final</version>
	</dependency>`

i feel i have done the right thing according to the tutorial i was following but all seem not to be working to get the name and email inputs validated. and this was the dependencies that the tutorial used. im new to spring but willing to be best at it. pls help me out