我有一个 FeignClient 类,我想使用 MatrixVariable 传递如下参数
@FeignClient(value = "apiService", url = "${api.url}", configuration =ApiServiceConfiguration.class)
public interface ApiServiceFeign {
@RequestMapping(value = "/students{matrixParam}", method = RequestMethod.GET)
StudentList getStudents(@MatrixVariable("matrixParam") Map<String,List<String>>);
}
但是当我使用上面的代码时它不起作用。Feign Client 无法理解 MatrixVariable。有没有办法打这个电话?
目前,我找到了使用 PathVariable 的临时解决方案,如下所示
@FeignClient(value = "apiService", url = "${api.url}", configuration =ApiServiceConfiguration.class)
public interface ApiServiceFeign {
@RequestMapping(value = "/students;name={name};accountId={accountId}", method = RequestMethod.GET)
StudentList getStudents(@PathVariable("name") String name,@PathVariable("accountId") Long accountId);
}
如果有人在 Feignclient 中使用 MatrixVariable 提供更好的解决方案,我真的很感激