我有一个 Spring Boot 应用程序,我试图用它Feign
来与远程服务进行通信。我@FeignClient
的定义如下:
@FeignClient(name="TEST_SERVICE", url="URL")
@Component
public interface SomeServiceClient
{
@RequestMapping(
method = RequestMethod.POST,
value = "/someService",
consumes = "application/json",
produces = "application/json"
)
SomeServiceResult getServiceResult(
@RequestParam(value = "mode") String mode,
@RequestParam(value = "payload") SomeServicePayload payload
);
}
我希望将payload
类型的对象SomeServicePayload
序列化为 JSON。我希望这会自动发生,但事实并非如此。相反,payload
被序列化为其完全限定的类名。
我是否需要为此客户端设置自定义编码器/解码器组合?我该怎么做?