Closed OlgaMaciaszek closed 2 months ago
@CC007 You need to add @RegisterReflectionForBinding(nl.cqit.function.poc.java.helloworld.api.model.Person.class)
and not for nl.cqit.function.poc.java.boxedhello.api.model.Person.class
as in the sample, since it's the former that is in the OF client method signature. After changing it, the sample works correctly.
This is a simple and fast workaround for the issue, however, I will also take a look at registering reflection hints for classes used in OF method signatures automatically.
This should actually work already as per https://github.com/spring-cloud/spring-cloud-openfeign/commit/06192a575cac356c2e6c826f4995976c24a337fb. Will need to verify why it doesn't work in the sample.
Given that we can reasonably assume that any method defined in either a @FeignClient interface or a supertype interface is supposed to be part of the API, we should register all such methods for reflection and not only the ones declared for the annotated interface. That will fix the issue.
Initially reported in https://github.com/spring-cloud/spring-cloud-openfeign/issues/860#issuecomment-1548713643.
Calling client generated with the sample: https://github.com/CodeQualIT/CQITFunctions, causes
feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for request type [nl.cqit.function.poc.java.helloworld.api.model.Person] and content type [application/json]
.Possibly related to class generation.
CC @CC007