Skip to content

Commit 998d667

Browse files
authored
Merge pull request #44096 from radcortez/fix-44073
Allow to use Simple Class name with @RegisterRestClient#configKey with MicroProfile config style
2 parents 012fbb4 + 5c4e42f commit 998d667

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/AbstractRestClientConfigBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder)
9797
String mpRestFullName = restClient.getFullName() + "/mp-rest/";
9898
microProfileFallbacks.put(quotedFullName, mpRestFullName);
9999
relocates.put(mpRestFullName, quotedFullName);
100-
if (configKey != null && !restClient.isConfigKeyEqualsNames()) {
100+
if (configKey != null && !configKey.equals(restClient.getFullName())) {
101101
String mpConfigKey = configKey + "/mp-rest/";
102102
microProfileFallbacks.put(mpRestFullName, mpConfigKey);
103103
relocates.put(mpConfigKey, quotedFullName);

extensions/resteasy-classic/rest-client-config/runtime/src/test/java/io/quarkus/restclient/config/RestClientConfigTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ public List<RegisteredRestClient> getRestClients() {
222222
})
223223
.build();
224224
assertNotNull(config);
225+
226+
RestClientsConfig restClientsConfig = config.getConfigMapping(RestClientsConfig.class);
227+
assertEquals(1, restClientsConfig.clients().size());
228+
assertTrue(restClientsConfig.clients().containsKey(MPConfigKeyRestClient.class.getName()));
229+
230+
RestClientConfig restClientConfig = restClientsConfig.getClient(MPConfigKeyRestClient.class);
231+
assertTrue(restClientConfig.uri().isPresent());
232+
assertThat(restClientConfig.uri().get()).isEqualTo("http://localhost:8082");
225233
}
226234

227235
private void verifyConfig(RestClientConfig config) {

extensions/resteasy-classic/rest-client-config/runtime/src/test/resources/application.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ mp.key/mp-rest/readTimeout=6000
5151
mp.key/mp-rest/followRedirects=true
5252
mp.key/mp-rest/proxyAddress=mp.key
5353
mp.key/mp-rest/queryParamStyle=COMMA_SEPARATED
54+
55+
MPConfigKeyRestClient/mp-rest/uri=http://localhost:8082

0 commit comments

Comments
 (0)