users@jersey.java.net

[Jersey] How to override a built-in exception mapper in Jersey 2.23?

From: Grzegorz <gregory.d3_at_gmail.com>
Date: Wed, 10 Aug 2016 11:39:21 +0200

Hi all,

In one of my projects I've already upgraded Jersey from version *2.14* to
*2.23*. But I'm struggling many hours with one problem.
My project defines its own ExceptionMapper for a "ValidationException", but
unfortunately Jersey already has a built-in exception mapper for this
exception:
org.glassfish.jersey.server.validation.internal.ValidationExceptionMapper and
I cannot override it.

I've also tried to use @Priority annotation for my custom mapper, but
unfortunately Jersey doesn't take it into account. In the previous Jersey
version (2.14) my mapper used to overwrite the built-in one. And IMHO it
was very intiuitive.

What is going on? Is it a regression bug or an intended change?

Kind Regards,
Greg