From 2fd56d524dfdbcaaf249d325b5310609bbf47a99 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 16 Sep 2024 11:26:19 +0300 Subject: [PATCH 1/2] Fix REST Client proxy configuration when multiple clients exist --- .../DevServicesRestClientHttpProxyProcessor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/devservices/DevServicesRestClientHttpProxyProcessor.java b/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/devservices/DevServicesRestClientHttpProxyProcessor.java index 9a68ff95ae88d..9817fa8148b93 100644 --- a/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/devservices/DevServicesRestClientHttpProxyProcessor.java +++ b/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/devservices/DevServicesRestClientHttpProxyProcessor.java @@ -68,7 +68,7 @@ public void determineRequiredProxies(RestClientsBuildTimeConfig restClientsBuild for (var configEntry : configs.entrySet()) { if (!configEntry.getValue().enableLocalProxy()) { log.trace("Ignoring config key: '" + configEntry.getKey() + "' because enableLocalProxy is false"); - break; + continue; } String configKey = configEntry.getKey(); @@ -91,7 +91,7 @@ public void determineRequiredProxies(RestClientsBuildTimeConfig restClientsBuild if (baseUri.isEmpty()) { log.debug("Unable to determine uri or url for config key '" + configKey + "'"); - break; + continue; } producer.produce(new RestClientHttpProxyBuildItem(matchingBI.getClassInfo().name().toString(), baseUri.get(), configEntry.getValue().localProxyProvider())); @@ -101,14 +101,14 @@ public void determineRequiredProxies(RestClientsBuildTimeConfig restClientsBuild if (classInfo == null) { log.debug( "Key '" + configKey + "' could not be matched to either a class name or a REST Client's configKey"); - break; + continue; } Optional baseUri = oneOf( Optional.ofNullable(restClientValues.get("uri")), Optional.ofNullable(restClientValues.get("url"))); if (baseUri.isEmpty()) { log.debug("Unable to determine uri or url for config key '" + configKey + "'"); - break; + continue; } producer.produce(new RestClientHttpProxyBuildItem(classInfo.name().toString(), baseUri.get(), configEntry.getValue().localProxyProvider())); From f2f4a2febc0f8861c7567b02d60cbfaa467f3317 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 16 Sep 2024 11:41:05 +0300 Subject: [PATCH 2/2] Use proper config key for REST Client override URI --- .../rest/client/reactive/runtime/RestClientBuilderImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java index 828034de5c9be..ceddd80f6ec89 100644 --- a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java +++ b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java @@ -399,7 +399,8 @@ public T build(Class aClass) throws IllegalStateException, RestClientDefi RestClientsConfig restClients = config.getConfigMapping(RestClientsConfig.class); // support overriding the URI from the override-uri property - Optional maybeOverrideUri = restClients.getClient(aClass).overrideUri(); + var overrideUrlKeyName = String.format("quarkus.rest-client.\"%s\".override-uri", aClass.getName()); + Optional maybeOverrideUri = config.getOptionalValue(overrideUrlKeyName, String.class); if (maybeOverrideUri.isPresent()) { uri = URI.create(maybeOverrideUri.get()); }