-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jersey creates multiple provider instances if a class implements more than one provider interface #3796
Labels
Milestone
Comments
@mkarg Commented |
@mkarg Commented |
|
I am the original reporter. |
This was referenced Jun 26, 2021
This was referenced Aug 5, 2021
This was referenced Sep 5, 2021
This was referenced Oct 4, 2021
This was referenced Oct 18, 2021
This was referenced Oct 21, 2021
Merged
Merged
This was referenced Oct 21, 2021
Closed
Closed
1 task
This was referenced Mar 7, 2022
This was referenced Mar 15, 2022
This was referenced May 11, 2022
1 task
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JAX-RS Specification 2.1 Chapter 4.1 Line 1: "By default a single instance of each provider class is instantiated for each JAX-RS application."
Jersey clearly violates this rule as it creates one instance of such a class per provider interface this class implements. For example, in case a class is annotated with
@Provider
and implements bothContainerRequestFilter
andContainerResponseFilter
then Jersey creates two instances, instead one instance. In case this class additionally implementsFeature
then Jersey even creates a third instance.Can be reproduce using the following code:
Here is the result it prints after the first invocation finished:
To be compliant to the mentioned chapter of the spec, the result MUST be this instead:
The text was updated successfully, but these errors were encountered: