我刚试过这个简单的应用程序,它对我来说很好用 Dalston.RC1
Dalston.RC1
@SpringBootApplication @EnableFeignClients @RestController public class DemoApplication { @Autowired SimpleServiceProxy proxy; public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } @RequestMapping("/") public String getCountry() { return proxy.getCountryInfo("Australia"); } } @FeignClient(name = "another-country-service-client", url ="http://restcountries.eu/rest/v2") interface SimpleServiceProxy { @RequestMapping(method = RequestMethod.GET, value = "/name/{country}", produces = "application/json") public String getCountryInfo(@PathVariable("country") String country); }
您的问题中的例外情况是在发出请求时通过Hystrix指示超时。您可以尝试禁用Hystrix并查看它是否消失 feign.hystrix.enabled=false 。
feign.hystrix.enabled=false