Autoconfiguration
This section shows how to set up autoconfiguration.
Steps to autoconfigure @HttpExchange clients:
- Specify clients.
 - Configure base-url.
 
Then you can inject the clients using whatever method you prefer.
Specify Clients
You can specify clients in two ways.
Using Annotation
To set up autoconfiguration, just use the @EnableExchangeClients
annotation. This works like @EnableFeignClients and tells the framework where to find HttpExchange clients, then registering them as beans.
By default, it looks for clients in the same package as the annotated class.
- 
Specifying
basePackages:@EnableExchangeClients(basePackages = "com.example")infoIf you specify packages with
basePackages, it will only look in those packages, not the one with the annotated class. - 
Specifying
clients:@EnableExchangeClients(clients = {PostApi.class, UserApi.class})infoThis is quicker than
basePackagesbecause it doesn't have to scan the classpath. - 
Combining
basePackageswithclients:@EnableExchangeClients(basePackages = "com.example", clients = {PostApi.class, UserApi.class}) 
Using Configuration
If you don't want to use annotations, you can set up using configuration.
http-exchange:
   base-packages: [ com.example ]
   clients:
     - com.foo.PostApi
     - com.bar.UserApi
If you use both the annotation and config file, the settings from the annotation are used first.
Configure base-url
http-exchange:
  base-packages: [ com.example ]
  channels:
    - base-url: http://user
      read-timeout: 3000
      clients:
        - com.example.user.api.*Api # Ant-style pattern
    - base-url: http://order
      read-timeout: 5000
      clients:
        - com.example.order.api.*Api