如何解决带有可选 RequestParam 的 FeignClient
我有一个带有以下方法的 FeignClient 接口
@RequestMapping(value="/test/{id}",method=RequestMethod.GET)
public String testMethod(@PathVariable String id,@RequestParam(name= "name",required = false) String name);
我想从其他类调用此方法,我尝试如下,但不确定如何传递可选的 RequestParam
,我可能需要传递或离开。因此我试着写像
@Autowired
private FeignClient feignInterface;
//With "name" requestparam
feignInterface.testMethod("123","NAME_SAMPLE");
//WithOUT "name" requestParam
feignInterface.testMethod("123"); //But when I would like to call like this,I get compilation error.
请问,我应该如何使用 FeignClient 调用 Optional Requestparam。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。