Details
-
Type:
Improvement
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.2 GA (Evans)
-
Fix Version/s: 2.3 RC1 (Fowler)
-
Component/s: Repositories
-
Labels:
-
Pull Request URL:
-
Sprint:55 - Evans SR2
Description
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.
But we should be keep in mind this issue https://jira.spring.io/browse/SPR-11570. I don't know if the previous mechanism can works without the shared @ControllerAdvice, but I will try it as soon as possible.
If accepted I can send a pull request. I have already forked a working repository with @ControllerAdvice