rreyes1979
rreyes1979

Reputation: 1945

System wide DAO level exception mapping to Http Status codes in Spring MVC 3.1

Is there anyway to map Spring exceptions (eg. JpaObjectRetrievalFailureException) to REST status code without using a controller specific @ExceptionHandler? I would like to configure that system wide.

Upvotes: 2

Views: 366

Answers (1)

beerbajay
beerbajay

Reputation: 20270

You can implement a HandlerExceptionResolver to catch specific exception types. Another possible strategy is to use a generic or abstract DAO class which implements the @ExceptionHandler handlers.

Upvotes: 1

Related Questions