Skip to content

Commit

Permalink
Merge pull request quarkusio#44096 from radcortez/fix-44073
Browse files Browse the repository at this point in the history
Allow to use Simple Class name with @RegisterRestClient#configKey with MicroProfile config style
  • Loading branch information
radcortez authored Nov 7, 2024
2 parents 012fbb4 + 5c4e42f commit 998d667
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder)
String mpRestFullName = restClient.getFullName() + "/mp-rest/";
microProfileFallbacks.put(quotedFullName, mpRestFullName);
relocates.put(mpRestFullName, quotedFullName);
if (configKey != null && !restClient.isConfigKeyEqualsNames()) {
if (configKey != null && !configKey.equals(restClient.getFullName())) {
String mpConfigKey = configKey + "/mp-rest/";
microProfileFallbacks.put(mpRestFullName, mpConfigKey);
relocates.put(mpConfigKey, quotedFullName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ public List<RegisteredRestClient> getRestClients() {
})
.build();
assertNotNull(config);

RestClientsConfig restClientsConfig = config.getConfigMapping(RestClientsConfig.class);
assertEquals(1, restClientsConfig.clients().size());
assertTrue(restClientsConfig.clients().containsKey(MPConfigKeyRestClient.class.getName()));

RestClientConfig restClientConfig = restClientsConfig.getClient(MPConfigKeyRestClient.class);
assertTrue(restClientConfig.uri().isPresent());
assertThat(restClientConfig.uri().get()).isEqualTo("http://localhost:8082");
}

private void verifyConfig(RestClientConfig config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ mp.key/mp-rest/readTimeout=6000
mp.key/mp-rest/followRedirects=true
mp.key/mp-rest/proxyAddress=mp.key
mp.key/mp-rest/queryParamStyle=COMMA_SEPARATED

MPConfigKeyRestClient/mp-rest/uri=http://localhost:8082

0 comments on commit 998d667

Please sign in to comment.