标签:cloud 服务 修改 eating beans com lan param ror
使用Feign组件进行远程服务的调用的时候,报错信息如下
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.example.eurekaclient1.feign.UserFeignClient‘: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: PathVariable annotation was empty on param 0.
Caused by: java.lang.IllegalStateException: PathVariable annotation was empty on param 0.
Feign接口中的代码如下:
@FeignClient(value = "eureka-client1")
public interface UserFeignClient {
@RequestMapping("/test/findById/{id}")
public User findById(@PathVariable int id);
}
修改之后不报错
@FeignClient(value = "eureka-client1")
public interface UserFeignClient {
@RequestMapping("/test/findById/{id}")
public User findById(@PathVariable(value = "id") int id);
}
记录:Feign组件进行HTTP调用的时候,如果路径中有@PathVariable,则需指明param。
标签:cloud 服务 修改 eating beans com lan param ror
原文地址:https://www.cnblogs.com/wypzpz/p/12940806.html