Skip to content

Conversation

@kakawait
Copy link
Contributor

@kakawait kakawait commented Dec 4, 2014

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.

odrotbohm pushed a commit that referenced this pull request Dec 5, 2014
odrotbohm added a commit that referenced this pull request Dec 5, 2014
Removed leftovers from AbstractRepositoryRestController. Renamed GlobalExceptionHandler to RepositoryRestExceptionHandler and minimized visibility of exception handler methods. Restricted application of the exception handler to controllers in the Spring Data REST base package.

Relatted pull request: #155.
@odrotbohm odrotbohm closed this Dec 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants