REST API client library configuration

A configuration describes all the parameters that define a single connection. The REST API client library configuration contains information about associated events, such as retry, circuit breaker, fallback, the settings for timeout, traceability, and authentication. The client library Config class instance represents the merged view of the configuration settings and provides the means to set the configuration preferences.

There are two approaches in implementing the library configuration, external and runtime. In the runtime configuration, the configuration parameters can be provided as classes, which instances that are build at runtime. In the external configuration the parameters are non-primitive objects that are externalized in files written in YAML or JSON syntax. The external and runtime configurations differ in the setting of the non JSON type properties. These properties are represented by a class name or the class name of a supplier. When configuring these properties, the external Config object expects classes, or the class of a supplier to create the desired object or a subclass of the desired object. The runtime Config expects an instance of the class.

The REST API client configuration properties are immutable objects and each object has a builder() static method. To clone an object, you must call the toBuilder() method. In cases when a supplier requires an additional information, this information is passed as a map to the class. Examples of such suppliers are a credential supplier, a context supplier, and an interceptor supplier.