-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Taking into account the @Priority
annotation when registering context providers
#32942
Conversation
@Priority
annotation in context providers@Priority
annotation when registering context providers
Are you sure that the a larger number means higher priority? In JAX-RS, it's usually the other way around (unless we are talking about @Provider classes on the write path). Perhaps we should make a check with |
You're right! Thanks for spotting. |
🙏🏼 |
4da3de9
to
b73870b
Compare
PR updated |
This comment has been minimized.
This comment has been minimized.
At the moment, users can register multiple context providers for handing the same class by using: ```java Client client = QuarkusRestClientBuilder.newBuilder() .baseUri(URI.create(uri)) .register(MyLowPriorityContextProvider.class) .register(MyHighPriorityContextProvider.class) .build(Client.class); ``` When doing this, REST Client Reactive will always return the first registered context provider for the matching type: ```java @priority(2) public static class MyLowPriorityContextProvider implements ContextResolver<Person> { @OverRide public Person getContext(Class<?> aClass) { // ... } } @priority(1) public static class MyHighPriorityContextProvider implements ContextResolver<Person> { @OverRide public Person getContext(Class<?> aClass) { // ... } } ``` With these changes, the `@Priority` annotation is taking into account to return the correct context provider regardless to when it has been registered.
b73870b
to
a96d221
Compare
Failing Jobs - Building a96d221
Full information is available in the Build summary check run. Failures⚙️ JVM Tests - JDK 17 Windows #- Failing: integration-tests/mongodb-panache
📦 integration-tests/mongodb-panache✖
|
The failures are unrelated to these changes. |
At the moment, users can register multiple context providers for handing the same class by using:
When doing this, REST Client Reactive will always return the first registered context provider for the matching type:
With these changes, the
@Priority
annotation is taking into account to return the correct context provider regardless to when it has been registered.