我有以下服务:
@FeignClient(name = "person", fallback = FeignHystrixFallback.class)
public interface PersonService {
@RequestMapping(value = "/find", method = RequestMethod.GET)
Person findPerson(@RequestParam("name") String name);
}
如何更改默认超时和线程池大小?
还有其他人遇到过这个问题并发布了问题并得到了答案。最相关的是这篇文章:
Feign builder timeouts not working
如果您想要管理Feign的配置,您可以查看Feign文档,查看@FeignClient注释的“configuration”属性。
设置此接口的自定义配置
@FeignClient(name="person", configuration = FeignConfig.class)
并进行配置
public class FeignConfig {
public static final int FIVE_SECONDS = 5000;
@Bean
public Request.Options options() {
return new Request.Options(FIVE_SECONDS, FIVE_SECONDS);
}
}