spring-projects/spring-data-rest — pull request #155 by kakawait (2014-12-04 22:17:58+00:00)
Title: @ExceptionHandler can't be override by @ControllerAdvice

Pull request for https://jira.spring.io/browse/DATAREST-421

`AbstractRepositoryRestController` defines a number of `@ExceptionHandler` however like clearly explain here http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc:

> `@ExceptionHandler` methods on the Controller are always selected before those on any `@ControllerAdvice` instance

So as user I can't override the _Spring DATA REST_ behavior without reimplement an `HandlerExceptionResolver` in order to inverse order choice between `@ControllerAdvice` and `@ExceptionHandler` methods.

By switching the `@ExceptionHandler` methods to an instance of `@ControllerAdvice` user can override behavior by adding another `@ControllerAdvice` with better `@Order` inside applicationContext.