Skip to main content

Configuration

This library provides a lot of configuration properties to customize the behavior of the client. You can configure the base-url, read-timeout for each channel, and each channel can apply to multiple clients.

Basic Usage

application.yaml
http-exchange:
read-timeout: 5000
channels:
- base-url: http://user
read-timeout: 3000
clients:
- com.example.user.api.*Api
- base-url: http://order
clients:
- com.example.order.api.*Api
warning

Since 3.4.0, Spring Boot introduced HttpClientProperties.

http-exchange.read-timeout and http-exchange.connect-timeout are deprecated, using spring.http.client.read-timeout and spring.http.client.connect-timeout instead.

Using property clients or classes to identify the client, use classes first if configured.

For example, there is a http client interface: com.example.PostApi, you can use the following configuration to identify the client

application.yaml
http-exchange:
channels:
- base-url: http://service
clients: [com.example.PostApi] # Class canonical name
# clients: [post-api] Class simple name (Kebab-case)
# clients: [PostApi] Class simple name (Pascal-case)
# clients: [com.**.*Api] (Ant-style pattern)
classes: [com.example.PostApi] # Class canonical name

Detailed Configuration

For an exhaustive list of all available configuration properties, please refer to the Configuration Properties documentation.

Example

See configuration example for usage example.