You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,23 @@ public interface PostApi {
153
153
}
154
154
```
155
155
156
+
### Dynamic Refresh Configuration
157
+
158
+
Support to dynamically refresh the configuration of clients, you can put the configuration in the configuration
159
+
center ([Consul](https://github.com/hashicorp/consul), [Apollo](https://github.com/apolloconfig/apollo), [Nacos](https://github.com/alibaba/nacos),
160
+
etc.), and change the configuration (e.g. `base-url`, `timeout`, `headers`), the client will be refreshed automatically
161
+
without restarting the application.
162
+
163
+
Use following configuration to enable this feature:
164
+
165
+
```yaml
166
+
http-exchange:
167
+
refresh:
168
+
enabled: true # default is false
169
+
```
170
+
171
+
> This feature needs `spring-cloud-context` in the classpath and a `RefreshEvent` was published.
172
+
156
173
### Configuration Driven
157
174
158
175
Providing a lot of configuration properties to customize the behavior of the client.
Autoconfigure clients, all you need to do is adding the `@EnableExchangeClients` annotation. `@EnableExchangeClients` is
121
108
very similar to `@EnableFeignClients`.
@@ -145,7 +132,7 @@ You can also specify the clients and the packages to scan at the same time.
145
132
146
133
> `Spring Cloud OpenFeign` does not support using `basePackages` and `clients` at the same time.
147
134
148
-
####Spring Web Annotations Support
135
+
### Spring Web Annotations Support
149
136
150
137
Support to use spring web annotations to generate HTTP client, e.g. `@RequestMapping`, `@GetMapping`, `@PostMapping`
151
138
etc.
@@ -158,34 +145,53 @@ public interface PostApi {
158
145
}
159
146
```
160
147
161
-
#### Configuration Driven
148
+
### Dynamic Refresh Configuration
149
+
150
+
Support to dynamically refresh the configuration of clients, you can put the configuration in the configuration
151
+
center ([Consul](https://github.com/hashicorp/consul), [Apollo](https://github.com/apolloconfig/apollo), [Nacos](https://github.com/alibaba/nacos),
152
+
etc.), and change the configuration (e.g. `base-url`, `timeout`, `headers`), the client will be refreshed automatically
153
+
without restarting the application.
154
+
155
+
Use following configuration to enable this feature:
156
+
157
+
```yaml
158
+
http-exchange:
159
+
refresh:
160
+
enabled: true # default is false
161
+
```
162
+
163
+
> This feature needs `spring-cloud-context` in the classpath and a `RefreshEvent` was published.
164
+
165
+
### Configuration Driven
162
166
163
167
Providing a lot of configuration properties to customize the behavior of the client.
164
168
165
169
You can configure the `base-url`, `timeout` and `headers` for each channel, and each channel can apply to multiple clients.
166
170
167
171
```yaml
168
172
http-exchange:
169
-
base-url: http://api-gateway # global base-url
170
-
response-timeout: 10000# global timeout
171
-
headers: # global headers
172
-
- key: X-App-Name
173
-
values: ${spring.application.name}
174
-
channels:
175
-
- base-url: http://order # client specific base-url, will override global base-url
176
-
response-timeout: 1000# client specific timeout, will override global timeout
177
-
headers: # client specific headers, will merge with global headers
178
-
- key: X-Key
179
-
values: [value1, value2]
180
-
clients: # client to apply this channel
181
-
- OrderApi
182
-
- base-url: user
183
-
response-timeout: 2000
184
-
clients:
185
-
- UserApi
186
-
- com.example.**.api.* # Ant-style pattern
187
-
- base-url: service-foo.namespace
188
-
classes: [com.example.FooApi] # client class to apply this channel
0 commit comments