【发布时间】:2018-01-05 17:44:32
【问题描述】:
我创建了Feign Client:
@FeignClient(name = "yandex",url="${yandex.ribbon.listOfServers}")
public interface YandexMapsRestApiServiceClient {
@RequestMapping(method = RequestMethod.GET, value = "{geoParam}")
String getCountryInfo(@Param("geoParam") String geoParam);
}
在控制器中我被写了:
@Autowired
private YandexMapsRestApiServiceClient client;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String test() {
return client.getCountryInfo("Moscow");
}
我的Applicaton.yml 看这个:
yandex:
ribbon:
listOfServers: https://geocode-maps.yandex.ru/1.x/?format=json&geocode=
ConnectTimeout: 20000
ReadTimeout: 20000
IsSecure: true
hystrix.command.default.execution:
timeout.enabled: true
isolation.thread.timeoutInMilliseconds: 50000
当我尝试得到一些结果时,我得到 404 错误:
feign.FeignException: status 404 reading YandexMapsRestApiServiceClient#getCountryInfo(String); content:
在这种情况下,我在调试器中看到他feign 没有设置我的geoParam:
为什么会发生这种情况以及如何解决这个问题?
【问题讨论】:
-
尝试使用 @RequestParam 而不是 @Param
标签: spring-boot spring-cloud-netflix netflix-feign spring-cloud-feign feign