Skip to content
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 using configKey resolves wrong config #45002

Closed
elvoe opened this issue Dec 9, 2024 · 5 comments · Fixed by #45044
Closed

REST Client using configKey resolves wrong config #45002

elvoe opened this issue Dec 9, 2024 · 5 comments · Fixed by #45044
Assignees
Labels
Milestone

Comments

@elvoe
Copy link

elvoe commented Dec 9, 2024

Describe the bug

I have 2 REST clients with the same simple class name but different packages:

dk.elvoe.experiments.client1.MyClient
dk.elvoe.experiments.client2.MyClient

They use different configKey:

@RegisterRestClient(configKey = "myConfig1") interface MyClient {}
@RegisterRestClient(configKey = "myConfig2") interface MyClient {}

I configure them using the configKey:

quarkus.rest-client.myConfig1.url=http://localhost:8081/hello1
quarkus.rest-client.myConfig2.url=http://localhost:8081/hello2

The bug is that requests made using client1.MyClient uses the URL of myConfig2.

Expected behavior

Using configKey should always resolve the corresponding configuration properties, regardless of the class name.

Actual behavior

Since Quarkus 3.17.0, a REST client may use the wrong configuration for a configKey, when multiple REST client interfaces have the same simple class name.

It works as expected in Quarkus 3.16.4.

How to Reproduce?

Reproducer: https://github.com/elvoe/quarkus-bug-rest-client-config

Run gradle check and the test method in MyTest will fail because of the Quarkus bug. It fails because the response from myClient1.get() is expected to receive the payload of the endpoint /hello1, but it actually receives the payload of the endpoint /hello2.

The test passes when changing the Quarkus version to 3.16.4.

Output of uname -a or ver

No response

Output of java -version

21

Quarkus version or git rev

3.17.3

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

The issue has similarities with #44989

@elvoe elvoe added the kind/bug Something isn't working label Dec 9, 2024
Copy link

quarkus-bot bot commented Dec 9, 2024

/cc @cescoffier (rest-client), @geoand (rest-client), @radcortez (config)

@gsmet
Copy link
Member

gsmet commented Dec 9, 2024

@radcortez could you have a look at this one? It looks related to the latest work done in this area and it looks quite problematic. Thanks!

@radcortez
Copy link
Member

Sure, I'll have a look.

@gsmet
Copy link
Member

gsmet commented Dec 9, 2024

@radcortez please also have a look at #44989 as they seem tightly related.

@radcortez
Copy link
Member

For now, please use the FQN of the REST Client to set up the configuration.

@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Dec 11, 2024
@gsmet gsmet modified the milestones: 3.18 - main, 3.17.5 Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants