Class AbstractRestClientConfigBuilder

java.lang.Object
io.quarkus.restclient.config.AbstractRestClientConfigBuilder
All Implemented Interfaces:
ConfigBuilder

public abstract class AbstractRestClientConfigBuilder extends Object implements ConfigBuilder
Registers and force load REST Client configuration.

To populate a Map, because the names are dynamic, the Config system has to rely on the list of property names provided by each source. This also applies to the REST Client, but since the names are known to Quarkus, the REST Client configuration could be loaded even for sources that don't provide a list of property names. To achieve such behaviour, we use WithKeys and RestClientsConfig.RestClientKeysProvider to provide the REST Client keys.

The REST Client configuration looks up the following names in order:

  1. quarkus.rest-client."[FQN of the REST Interface]".*
  2. quarkus.rest-client.[Simple Name of the REST Interface].*
  3. quarkus.rest-client."[Simple Name of the REST Interface]".*
  4. quarkus.rest-client.[Config Key from @RegisterRestClient].*
  5. quarkus.rest-client."[Config Key from @RegisterRestClient]".*
  6. [FQN of the REST Interface]/mp-rest/*
  7. [Config Key from @RegisterRestClient]/mp-rest/*
The order follows the same logic specified in the MicroProfile Config REST Client, where the FQN names have priority over RegisterRestClient.configKey().

The RegisterRestClient.configKey() lookups are not included in case the configKey value is null. A fallback is generated for a quoted key when the configKey is a single segment.

The concrete implementation is bytecode generated in io.quarkus.restclient.config.deployment.RestClientConfigUtils#generateRestClientConfigBuilder

  • Constructor Details

    • AbstractRestClientConfigBuilder

      public AbstractRestClientConfigBuilder()
    • AbstractRestClientConfigBuilder

      public AbstractRestClientConfigBuilder(boolean runtime)
  • Method Details

    • configBuilder

      public io.smallrye.config.SmallRyeConfigBuilder configBuilder(io.smallrye.config.SmallRyeConfigBuilder builder)
      Specified by:
      configBuilder in interface ConfigBuilder
    • getRestClients

      public abstract List<RegisteredRestClient> getRestClients()
      The List of discovered REST Clients, generated during build-time.
      Returns:
      a List of RegisteredRestClient generated by Quarkus.