current position:Home>My feign interface parameter defines a parent type, why do I report a type conversion error when I convert it to a subclass in the method?The caller passes the subclass

My feign interface parameter defines a parent type, why do I report a type conversion error when I convert it to a subclass in the method?The caller passes the subclass

2022-08-06 05:12:13Alibaba Cloud Q&A

My feign interface parameter defines a parent type, why do I report a type conversion error when I convert it to a subclass in the method?The caller passes the subclass.




Accepted answer 1:

If it is a supertype, it means that the framework has reassigned an object, and this object uses the type of your interface.

Openfeign generally does not carry class information after serialization, just an ordinary json. When deserializing, the interface defines the type.

This answer is from the DingTalk group "Group 5 Spring Cloud Alibaba"


copyright notice
author[Alibaba Cloud Q&A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/218/202208041313366865.html

Random recommended