-
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
REST client reactive should allow to instantiate clients based on (external) classes without @RegisterRestClient
annotation
#37007
Comments
/cc @cescoffier (rest-client), @geoand (rest-client) |
@cescoffier, @geoand issue created as discussed. |
So simply using the configuration above makes the classic rest client work? Nothing else involved? |
Yes, with the same configuration, the classic client just instantiates and injects the bean, whereas the rest reactive client doesn't produce a candidate for injection (no client gets instantiated). |
I personally think that enabling this feature from the old client makes sense. |
The scope should be default Singleton imo and not required to be specified in the configuration. Because only ApplicationScope is needed for mocking in tests and this can already be done. |
@lw-mcno do you have an example of this working for RESTEasy Classic that I can use? |
Hi @geoand I've added a simple reproducer here: https://github.com/lw-mcno/quarkus-rest-client-classic-without-registration BTW. is it allowed to have reactive server and classic clients? From my experiments here, it doesn't seem so. When I had |
@lw-mcno thanks. So I just saw that the classic REST Client unconditionally registers the interface as a bean, even if there is no configuration. That is something I am not willing to add to the reactive version of the client. However, I do see merit in the proposal to register the client as a bean when quarkus:
rest-client:
"org.acme.ExampleRestService":
scope: whatever is set. |
#37580 is what I have in mind |
@geoand : Thanks for looking into this and great that the functionality can be extended to accomodate our use case. |
Make REST Client a bean when the scope property is set in config
Description
During the migration from rest-client to rest-client-reactive, it has turned out, that the reactive doesn't allow to instantiate clients based on external (imported from dependencies) interface definitions (lacking the
@RegisterRestClient
annotation).In the rest-client classic, this configuration alone is sufficient to instantiate a client bean (providing that
MyRestServiceClass
contains appropriate JAX-RS annotations):Implementation ideas
It was discussed in the Zulip chat, and suggested by @Ladicek, that such a functionality (automatically adding
@RegisterRestClient
during build time to classes injected into@RestClient
-annotated slots), could be implemented using a build step.The text was updated successfully, but these errors were encountered: