我创建了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
:
为什么会发生这种情况以及如何解决这个问题?