@valid annotation doesnt work

I was referring to this section link

  1. I have defeined the Athlete model with lastName as mandatory.

  2. I have also defined AthleteController as follows with @valid annotation associated with

     public String processPlayerForm(@ModelAttribute("athlete") @Valid Athlete athlete,
     		BindingResult result) {
     	if (result.hasErrors()) {
     		return "add-player-form";
     	return "player-confirmation";
  3. I have created the form where the last name can be inputed from user.

     <form:form action="processPlayerForm" modelAttribute="athlete">
     	Last Name *: <form:input path="lastName"/>
     	         	  <form:errors path="lastName" cssClass="error"/><br>

When empty values are given in the form and submitted, annotation doesnt throw any error. Can someone pls help me with what mistake am i doing?

pom.xml - dependencies:

	<!-- For spring MVC -->


    <context:component-scan base-package="io.learn.springmvc" />

    <mvc:annotation-driven />