Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

short way to configure feign client #1931

Closed
khannedy opened this issue May 11, 2017 · 3 comments
Closed

short way to configure feign client #1931

khannedy opened this issue May 11, 2017 · 3 comments
Milestone

Comments

@khannedy
Copy link
Contributor

Hi all, I have problem with current Feign Client configuration via Configuration Class.

Currently I create feign client using this way :

@FeignClient(name = "authFeign",
    url = "${service.auth.endpoint}",
    fallbackFactory = AuthFeignFallbackFactory.class,
    configuration = AuthConfiguration.class)
public interface AuthFeign {

}

and every time I create feign client, I create configuration class.

@Configuration
public class AuthConfiguration {

  @Autowired
  private FeignAuthProperties properties;

  @Bean
  public Request.Options options() {
    return new Request.Options(
        (int) properties.getTimeUnit().toMillis(properties.getConnectTimeout()),
        (int) properties.getTimeUnit().toMillis(properties.getReadTimeout())
    );
  }

  @Bean
  public Logger.Level level(){
    return properties.getLevel();
  }

}

Is there any short way to configure feign client just via configuration properties? example :

feign.authFeign.connect-timeout=2000
feign.authFeign.read-timeout=2000
feign.authFeign.log-level=basic

If there is no way to configure feign client via configuration properties, I will happy to contribute to this repository

Best Regards.

@ryanjbaxter
Copy link
Contributor

I dont believe there are properties for this, but instead of specifying the configuration property for each client, if you want those values to apply to all Feign clients you can just create those beans as part of your applications configuration.

@khannedy
Copy link
Contributor Author

hi @ryanjbaxter , I think it is very helpful if we can also configure default feign client configuration via properties, like :

feign.client.default.connect-timeout=10000
feign.client.default.read-timeout=10000
feign.client.default.logging-level=basic
feign.client.default.retryer=...
feign.client.default.error-decoder=...
feign.client.default.request-interceptors=...

and if we need to create configuration per feign client, we can also override the values

feign.client.default.connect-timeout=10000
feign.client.default.read-timeout=10000
feign.client.default.logging-level=basic
feign.client.default.retryer=...
feign.client.default.error-decoder=...
feign.client.default.request-interceptors=...

feign.client.feignName.connect-timeout=2000
feign.client.feignName.read-timeout=2000
feign.client.feignName.logging-level=headers

@ryanjbaxter
Copy link
Contributor

this would be an enhancement as far as i know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants