知乎专栏 | 多维度架构 |
@Configuration @EnableFeignClients public class FeignConfiguration { @Bean public Contract feignContract() { return new feign.Contract.Default(); } @Bean public BasicAuthRequestInterceptor basicAuthRequestInterceptor() { return new BasicAuthRequestInterceptor("user", "password"); } }
@FeignClient(name="myServiceName", url="localhost:8888") public interface OpenfeignService { @RequestMapping("/") public String getName(); }
系统默认是 httpclient
<dependency> <groupId>io.github.openfeign</groupId> <artifactId>feign-httpclient</artifactId> </dependency>
httpclient
feign.httpclient.enabled=true feign.httpclient.max-connections=1000 feign.httpclient.max-connections-per-route=50