如何解决在Feign Client Java中将空集传递到请求参数
我的假装客户有问题。 我有看起来像这样的休息资源
@GetMapping("/query")
public Set<Long> getTenantIdsByPropertyId(@AuthenticationPrincipal UserPrincipal principal,@RequestParam @Positive Long propertyId,@RequestParam(required = false) Set<ContractStatus> statuses) {
return contractService.getTenantIdsByPropertyId(principal.getOrganizationId(),propertyId,statuses);
}
我想使用伪装客户端从另一个微服务中调用此终结点
@GetMapping("/query")
Set<Long> getTenantIdsByPropertyId(@RequestHeader("Cookie") String cookie,@RequestParam(name = "propertyId") Long propertyId,@RequestParam(name = "statuses") Collection<ContractStatus> statuses)
throws RequestProcessingException;
ContractStatus只是一个常规枚举。
但是当我对此进行测试时,出现以下错误:
2020-10-05 12:45:11.846 ERROR 27478 --- [nio-8083-exec-1] c.z.c.a.h.ApplicationExceptionHandler : org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.util.Set'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.RequestParam com.zpot.contract.common.enumeration.ContractStatus] for value 'null'; nested exception is java.lang.IllegalArgumentException: No enum constant com.zpot.contract.common.enumeration.ContractStatus.null
问题是如何使用伪客户端传递空集以调用端点? 预先感谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。