I found the solution for the above problem. Actually @ControllerAdvice needs MVC namespace declaration in XML file. Or we can use @EnableWebMvc with @ControllerAdvice annotation
.
@EnableWebMvc
@ControllerAdvice
public class BaseController {
@ExceptionHandler()
public void handleException(Exception e) {
System.out.println("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
}
}
.