title: @ExceptionHandler for all controllers in spring-mvc
body: <p>I have wrote following controller to handle all exception in my code: </p>
  
  <pre><code>@Controller
  public class ErrorHandlerController {
  
      @ExceptionHandler(value = Exception.class)
      public String redirectToErrorPage(Model model){
          model.addAttribute("message", "error on server");
          return "errorPage";
      }
  }
  </code></pre>
  
  <p>But looks like following exception handler will work only if exception throws inside <code>ErrorHandlerController</code></p>
  
  <p>I have a huge count of controllers. Please advice me how to write one ExceptionHandler for all controllers ? </p>
  
  <p>P.S.</p>
  
  <p>I understand that I can use inheritance but I don't sure that it is the best decision.</p>