-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
I tried to use next interface with AsyncFeign:
@Headers({ "Content-Type: application/json", "Accept: application/json" })
public interface V1AsyncEndpoint<T> {
@RequestLine("POST /api/v1/projects/{project}/{resource}/byids")
@Headers("Authorization: Bearer {token}")
CompletableFuture<T> getPageByIds(
@Param("token") String token,
@Param("project") String project,
@Param("resource") String resource,
@Param("items") Collection<Long> ids,
@Param("ignoreUnknownIds") boolean ignoreUnknownIds,
@Nullable
@Param("aggregatedProperties") Collection<String> aggregatedProperties);
}
for Type:
class Data {
String a;
Long b;
}
But getPageByIds always returns com.google.gson.internal.LinkedTreeMap and then I get java.util.concurrent.CompletionException: java.lang.ClassCastException: class com.google.gson.internal.LinkedTreeMap
If I use
@Headers({ "Content-Type: application/json", "Accept: application/json" })
public interface V1AsyncEndpoint {
@RequestLine("POST /api/v1/projects/{project}/{resource}/byids")
@Headers("Authorization: Bearer {token}")
CompletableFuture<Data> getPageByIds(
@Param("token") String token,
@Param("project") String project,
@Param("resource") String resource,
@Param("items") Collection<Long> ids,
@Param("ignoreUnknownIds") boolean ignoreUnknownIds,
@Nullable
@Param("aggregatedProperties") Collection<String> aggregatedProperties);
}
everything works correctly.
I've made short debugging and I noticed the AsyncFeign decoder gets T as type instead of Data when deserialisation happens.
I use version: 11.8
Metadata
Metadata
Assignees
Labels
No labels